Skip to content

Commit aee82c7

Browse files
Merge branch 'bugfix/outbox_init_failure' into 'master'
Fix: Outbox was leaked in case of initialization failure See merge request espressif/esp-mqtt!180
2 parents 5896e25 + 5d491a4 commit aee82c7

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/mqtt_outbox.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ outbox_handle_t outbox_init(void)
3333
outbox_handle_t outbox = calloc(1, sizeof(struct outbox_t));
3434
ESP_MEM_CHECK(TAG, outbox, return NULL);
3535
outbox->list = calloc(1, sizeof(struct outbox_list_t));
36-
ESP_MEM_CHECK(TAG, outbox->list, return NULL); //TODO: Free outbox on failure
36+
ESP_MEM_CHECK(TAG, outbox->list, {free(outbox); return NULL;});
3737
outbox->size = 0;
3838
STAILQ_INIT(outbox->list);
3939
return outbox;

0 commit comments

Comments
 (0)