[cairo-commit] 2 commits - src/cairo-scaled-font-subsets.c

Chris Wilson ickle at kemper.freedesktop.org
Sun Jul 6 08:42:28 PDT 2008


 src/cairo-scaled-font-subsets.c |    4 ++++
 1 file changed, 4 insertions(+)

New commits:
commit fe7973d60a53b5c7465fd616c515f8fc1ac6cb12
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Sun Jul 6 15:15:15 2008 +0100

    [cairo-scaled-font-subsets] Fix memleak.
    
    Valgrind reported that sub_font_glyph->utf8 was not being freed along
    with the cairo_sub_font_glyph_t.

diff --git a/src/cairo-scaled-font-subsets.c b/src/cairo-scaled-font-subsets.c
index ab67560..6cfccac 100644
--- a/src/cairo-scaled-font-subsets.c
+++ b/src/cairo-scaled-font-subsets.c
@@ -174,6 +174,9 @@ _cairo_sub_font_glyph_create (unsigned long	scaled_font_glyph_index,
 static void
 _cairo_sub_font_glyph_destroy (cairo_sub_font_glyph_t *sub_font_glyph)
 {
+    if (sub_font_glyph->utf8 != NULL)
+	free (sub_font_glyph->utf8);
+
     free (sub_font_glyph);
 }
 
commit 07b39ee3c0f053598fdebdd160dc881566ad7fcd
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Sun Jul 6 15:14:22 2008 +0100

    [cairo-scaled-font-subsets] Fix use of unitialised variable.
    
    Valgrind reported that pdf-operators tried to use an uninitialised
    subset_glyph->utf8_is_mapped.

diff --git a/src/cairo-scaled-font-subsets.c b/src/cairo-scaled-font-subsets.c
index ff6d5bf..ab67560 100644
--- a/src/cairo-scaled-font-subsets.c
+++ b/src/cairo-scaled-font-subsets.c
@@ -487,6 +487,7 @@ _cairo_sub_font_map_glyph (cairo_sub_font_t	*sub_font,
     subset_glyph->is_composite = sub_font->is_composite;
     subset_glyph->x_advance = sub_font_glyph->x_advance;
     subset_glyph->y_advance = sub_font_glyph->y_advance;
+    subset_glyph->utf8_is_mapped = FALSE;
 
     return CAIRO_STATUS_SUCCESS;
 }


More information about the cairo-commit mailing list