Merge branch 'bugfix/memory_issues_pr838' into 'master'
vfat, i2s, mdns: Fix two memory leaks, one double free (github #838) See merge request !1173
This commit is contained in:
commit
b4857fc159
|
@ -435,7 +435,7 @@ static i2s_dma_t *i2s_create_dma_queue(i2s_port_t i2s_num, int dma_buf_count, in
|
||||||
dma->buf = (char **)malloc(sizeof(char*) * dma_buf_count);
|
dma->buf = (char **)malloc(sizeof(char*) * dma_buf_count);
|
||||||
if (dma->buf == NULL) {
|
if (dma->buf == NULL) {
|
||||||
ESP_LOGE(I2S_TAG, "Error malloc dma buffer pointer");
|
ESP_LOGE(I2S_TAG, "Error malloc dma buffer pointer");
|
||||||
|
free(dma);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
memset(dma->buf, 0, sizeof(char*) * dma_buf_count);
|
memset(dma->buf, 0, sizeof(char*) * dma_buf_count);
|
||||||
|
|
|
@ -83,6 +83,7 @@ esp_err_t esp_vfs_fat_spiflash_mount(const char* base_path,
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
free(workbuf);
|
free(workbuf);
|
||||||
|
workbuf = NULL;
|
||||||
ESP_LOGI(TAG, "Mounting again");
|
ESP_LOGI(TAG, "Mounting again");
|
||||||
fresult = f_mount(fs, drv, 0);
|
fresult = f_mount(fs, drv, 0);
|
||||||
if (fresult != FR_OK) {
|
if (fresult != FR_OK) {
|
||||||
|
|
|
@ -1755,6 +1755,7 @@ esp_err_t mdns_service_add(mdns_server_t * server, const char * service, const c
|
||||||
|
|
||||||
item = (mdns_srv_item_t *)malloc(sizeof(mdns_srv_item_t));
|
item = (mdns_srv_item_t *)malloc(sizeof(mdns_srv_item_t));
|
||||||
if (!item) {
|
if (!item) {
|
||||||
|
free(s);
|
||||||
return ESP_ERR_NO_MEM;
|
return ESP_ERR_NO_MEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue