From 403019482b0d7f17fbdb5def2be5f43e28bafcf3 Mon Sep 17 00:00:00 2001 From: Ebrahim Byagowi Date: Sat, 22 Sep 2018 17:24:03 +0330 Subject: [PATCH] Fix test-subset-* leak issues See also https://github.com/harfbuzz/harfbuzz/pull/1169 --- test/api/hb-subset-test.h | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/test/api/hb-subset-test.h b/test/api/hb-subset-test.h index afd553a0d..0318fa7bb 100644 --- a/test/api/hb-subset-test.h +++ b/test/api/hb-subset-test.h @@ -51,12 +51,18 @@ static inline hb_face_t * hb_subset_test_open_font (const char *font_path) { #if GLIB_CHECK_VERSION(2,37,2) - char* path = g_test_build_filename(G_TEST_DIST, font_path, NULL); + char* path = g_test_build_filename (G_TEST_DIST, font_path, NULL); #else - char* path = g_strdup(font_path); + char* path = g_strdup (font_path); #endif - return hb_face_create (hb_blob_create_from_file (path), 0); + hb_blob_t* blob = hb_blob_create_from_file (path); + hb_face_t* face = hb_face_create (blob, 0); + hb_blob_destroy (blob); + + g_free (path); + + return face; } static inline hb_subset_input_t *