mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
fix(jpeg): Fix memory leak on jpeg decoder
This commit is contained in:
parent
4ee54026e3
commit
4881a2aca0
@ -169,7 +169,9 @@ esp_err_t jpeg_isr_deregister(jpeg_codec_handle_t jpeg_codec, jpeg_isr_handler_t
|
||||
break;
|
||||
}
|
||||
prev = it;
|
||||
free(prev);
|
||||
}
|
||||
if (found) {
|
||||
free(it);
|
||||
}
|
||||
if (unlikely(found != true)) {
|
||||
return ESP_ERR_INVALID_STATE;
|
||||
|
@ -263,6 +263,9 @@ esp_err_t jpeg_del_decoder_engine(jpeg_decoder_handle_t decoder_engine)
|
||||
if (decoder_engine->header_info) {
|
||||
free(decoder_engine->header_info);
|
||||
}
|
||||
if (decoder_engine->trans_desc) {
|
||||
free(decoder_engine->trans_desc);
|
||||
}
|
||||
if (decoder_engine->evt_queue) {
|
||||
vQueueDeleteWithCaps(decoder_engine->evt_queue);
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ TEST_CASE("JPEG decode driver memory leaking check", "[jpeg]")
|
||||
};
|
||||
|
||||
int size = esp_get_free_heap_size();
|
||||
for (uint32_t i = 0; i <= 3; i++) {
|
||||
for (uint32_t i = 0; i <= 10; i++) {
|
||||
TEST_ESP_OK(jpeg_new_decoder_engine(&decode_eng_cfg, &jpgd_handle));
|
||||
vTaskDelay(10 / portTICK_PERIOD_MS);
|
||||
TEST_ESP_OK(jpeg_del_decoder_engine(jpgd_handle));
|
||||
|
Loading…
Reference in New Issue
Block a user