From: Seven Du Date: Wed, 3 Jun 2020 00:58:35 +0000 (+0800) Subject: [core] fix memeory leak when font not found X-Git-Tag: v1.10.7^2~172 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=64aebc31ed8edbc0b96c3cf2781cac445bb40905;p=thirdparty%2Ffreeswitch.git [core] fix memeory leak when font not found --- diff --git a/src/switch_core_video.c b/src/switch_core_video.c index 6a9351cdaa..2f7b07d4bd 100644 --- a/src/switch_core_video.c +++ b/src/switch_core_video.c @@ -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) { 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) { switch_core_destroy_memory_pool(&pool); }