]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
[core] fix memeory leak when font not found
authorSeven Du <dujinfang@gmail.com>
Wed, 3 Jun 2020 00:58:35 +0000 (08:58 +0800)
committerAndrey Volk <andywolk@gmail.com>
Sat, 23 Oct 2021 19:00:05 +0000 (22:00 +0300)
src/switch_core_video.c

index 6a9351cdaad620ec74e1c0393b870f6ab5a4f3bb..2f7b07d4bd52db643e779dd0cc69c3c3c5ad534f 100644 (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) {
                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);
                }