[core] fix memeory leak when font not found

This commit is contained in:
Seven Du 2020-06-03 08:58:35 +08:00 committed by Andrey Volk
parent 7874d2eb7e
commit 64aebc31ed
1 changed files with 6 additions and 0 deletions

View File

@ -1897,6 +1897,12 @@ SWITCH_DECLARE(switch_status_t) switch_img_txt_handle_create(switch_img_txt_hand
if (switch_file_exists(new_handle->font_family, new_handle->pool) != SWITCH_STATUS_SUCCESS) { if (switch_file_exists(new_handle->font_family, new_handle->pool) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Font %s does not exist\n", new_handle->font_family); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Font %s does not exist\n", new_handle->font_family);
#if SWITCH_HAVE_FREETYPE
if (new_handle->library) {
FT_Done_FreeType(new_handle->library);
new_handle->library = NULL;
}
#endif
if (free_pool) { if (free_pool) {
switch_core_destroy_memory_pool(&pool); switch_core_destroy_memory_pool(&pool);
} }