summaryrefslogtreecommitdiff
path: root/test/api
diff options
context:
space:
mode:
authorPhilip Withnall <philip@tecnocode.co.uk>2017-02-08 02:18:33 +0000
committerBehdad Esfahbod <behdad@behdad.org>2017-02-07 18:18:33 -0800
commita6ced90efccf869defc0b310effca220f01cf318 (patch)
treef3cfa80b87dc7a7e817b3408860c5232c04918b5 /test/api
parent925ceacfed45c44dd2a025c32bebb1358b560741 (diff)
downloadharfbuzz-a6ced90efccf869defc0b310effca220f01cf318.tar.gz
test: Fix some memory leaks in test-font.c (#409)
Coverity IDs: 141039, 141040, 141041
Diffstat (limited to 'test/api')
-rw-r--r--test/api/test-font.c35
1 files changed, 30 insertions, 5 deletions
diff --git a/test/api/test-font.c b/test/api/test-font.c
index 34f6c746..527dfcdc 100644
--- a/test/api/test-font.c
+++ b/test/api/test-font.c
@@ -35,13 +35,23 @@ static const char test_data[] = "test\0data";
static void
test_face_empty (void)
{
+ hb_face_t *created_from_empty;
+ hb_face_t *created_from_null;
+
g_assert (hb_face_get_empty ());
- g_assert (hb_face_get_empty () != hb_face_create (hb_blob_get_empty (), 0));
- g_assert (hb_face_get_empty () != hb_face_create (NULL, 0));
+
+ created_from_empty = hb_face_create (hb_blob_get_empty (), 0);
+ g_assert (hb_face_get_empty () != created_from_empty);
+
+ created_from_null = hb_face_create (NULL, 0);
+ g_assert (hb_face_get_empty () != created_from_null);
g_assert (hb_face_reference_table (hb_face_get_empty (), HB_TAG ('h','e','a','d')) == hb_blob_get_empty ());
g_assert_cmpint (hb_face_get_upem (hb_face_get_empty ()), ==, 1000);
+
+ hb_face_destroy (created_from_null);
+ hb_face_destroy (created_from_empty);
}
static void
@@ -357,14 +367,29 @@ test_fontfuncs_subclassing (void)
static void
test_font_empty (void)
{
+ hb_font_t *created_from_empty;
+ hb_font_t *created_from_null;
+ hb_font_t *created_sub_from_null;
+
g_assert (hb_font_get_empty ());
- g_assert (hb_font_get_empty () != hb_font_create (hb_face_get_empty ()));
- g_assert (hb_font_get_empty () != hb_font_create (NULL));
- g_assert (hb_font_get_empty () != hb_font_create_sub_font (NULL));
+
+ created_from_empty = hb_font_create (hb_face_get_empty ());
+ g_assert (hb_font_get_empty () != created_from_empty);
+
+ created_from_null = hb_font_create (NULL);
+ g_assert (hb_font_get_empty () != created_from_null);
+
+ created_sub_from_null = hb_font_create_sub_font (NULL);
+ g_assert (hb_font_get_empty () != created_sub_from_null);
+
g_assert (hb_font_is_immutable (hb_font_get_empty ()));
g_assert (hb_font_get_face (hb_font_get_empty ()) == hb_face_get_empty ());
g_assert (hb_font_get_parent (hb_font_get_empty ()) == NULL);
+
+ hb_font_destroy (created_sub_from_null);
+ hb_font_destroy (created_from_null);
+ hb_font_destroy (created_from_empty);
}
static void