mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-03 20:54:32 +02:00
i2s: fix leak in i2s_create_dma_queue if we have a malloc issue.
This commit is contained in:
committed by
Angus Gratton
parent
a1b5813049
commit
36eccee213
@@ -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);
|
||||||
|
Reference in New Issue
Block a user