Very small Pango patch



Hi,

I've spent some time today looking at libgnomecanvas. While profiling the 
demo I've found a leak in Pango. It's actually quite subtle. In 
libgnomecanvas a PangoFontDescription is allocated and freed through 
pango_font_description_from_string (in gnome_canvas_text_set_property) and 
pango_font_description_free respectively. The description_free function 
checks the static_family variable before freeing the family_name, now, the 
description_from_string doesn't initialize that variable due to which 
sometimes it leaks (and sometimes it doesn't ;) ). So here's the nobrainer 
type of patch.

Zack Rusin

Index: pango/fonts.c
===================================================================
RCS file: /cvs/gnome/pango/pango/fonts.c,v
retrieving revision 1.44
diff -u -3 -p -r1.44 fonts.c
--- pango/fonts.c       2002/01/14 16:40:08     1.44
+++ pango/fonts.c       2002/01/16 12:07:48
@@ -810,7 +810,8 @@ pango_font_description_from_string (cons
                PANGO_FONT_MASK_VARIANT |
                PANGO_FONT_MASK_STRETCH;

-  desc->family_name = NULL;
+  desc->family_name   = NULL;
+  desc->static_family = FALSE;
   desc->style = PANGO_STYLE_NORMAL;
   desc->weight = PANGO_WEIGHT_NORMAL;
   desc->variant = PANGO_VARIANT_NORMAL;


-- 
43rd Law of Computing: Anything that can go wr
fortune: Segmentation violation -- Core dumped



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]