]> granicus.if.org Git - esp-idf/commitdiff
i2s: fix leak in i2s_create_dma_queue if we have a malloc issue.
authorQuentin Thérond <q.therond@overkiz.com>
Tue, 25 Jul 2017 12:14:03 +0000 (14:14 +0200)
committerAngus Gratton <gus@projectgus.com>
Wed, 30 Aug 2017 02:11:03 +0000 (12:11 +1000)
components/driver/i2s.c

index f78745f3292221109f3bfd56b44780239ec66741..1816a55e8242c3a0f7e722e8bbaf77eee168af9c 100644 (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);