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:
Ivan Grokhotkov 2017-08-31 10:45:19 +08:00
commit b4857fc159
3 changed files with 3 additions and 1 deletions

View file

@ -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);
if (dma->buf == NULL) {
ESP_LOGE(I2S_TAG, "Error malloc dma buffer pointer");
free(dma);
return NULL;
}
memset(dma->buf, 0, sizeof(char*) * dma_buf_count);

View file

@ -83,6 +83,7 @@ esp_err_t esp_vfs_fat_spiflash_mount(const char* base_path,
goto fail;
}
free(workbuf);
workbuf = NULL;
ESP_LOGI(TAG, "Mounting again");
fresult = f_mount(fs, drv, 0);
if (fresult != FR_OK) {

View file

@ -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));
if (!item) {
free(s);
return ESP_ERR_NO_MEM;
}