[HarfBuzz] harfbuzz: Branch 'master' - 2 commits

Behdad Esfahbod behdad at kemper.freedesktop.org
Wed Feb 8 02:19:53 UTC 2017


 test/api/test-font.c |   35 ++++++++++++++++++++++++++++++-----
 util/hb-shape.cc     |    4 +++-
 2 files changed, 33 insertions(+), 6 deletions(-)

New commits:
commit a6ced90efccf869defc0b310effca220f01cf318
Author: Philip Withnall <philip at tecnocode.co.uk>
Date:   Wed Feb 8 02:18:33 2017 +0000

    test: Fix some memory leaks in test-font.c (#409)
    
    Coverity IDs: 141039, 141040, 141041

diff --git a/test/api/test-font.c b/test/api/test-font.c
index 34f6c74..527dfcd 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
commit 925ceacfed45c44dd2a025c32bebb1358b560741
Author: Philip Withnall <philip at tecnocode.co.uk>
Date:   Wed Feb 8 02:17:48 2017 +0000

    util: Add missing field initialisers in constructor (#410)
    
    Coverity ID: 141042

diff --git a/util/hb-shape.cc b/util/hb-shape.cc
index 3bd2184..75c3793 100644
--- a/util/hb-shape.cc
+++ b/util/hb-shape.cc
@@ -35,7 +35,9 @@ struct output_buffer_t
 		    format (parser),
 		    gs (NULL),
 		    line_no (0),
-		    font (NULL) {}
+		    font (NULL),
+		    output_format (HB_BUFFER_SERIALIZE_FORMAT_INVALID),
+		    format_flags (HB_BUFFER_SERIALIZE_FLAG_DEFAULT) {}
 
   void init (const font_options_t *font_opts)
   {


More information about the HarfBuzz mailing list