[gtk+] label: plug a memory leak



commit 503be101480b47a098146ac6ac2900fc16855124
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Tue Dec 7 10:13:32 2010 +0100

    label: plug a memory leak

 gtk/gtklabel.c |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)
---
diff --git a/gtk/gtklabel.c b/gtk/gtklabel.c
index 563845c..53b2df7 100644
--- a/gtk/gtklabel.c
+++ b/gtk/gtklabel.c
@@ -3014,13 +3014,19 @@ get_font_metrics (PangoContext *context, GtkWidget *widget)
 {
   GtkStyleContext *style_context;
   PangoFontDescription *font;
+  PangoFontMetrics *retval;
 
   style_context = gtk_widget_get_style_context (widget);
   gtk_style_context_get (style_context, 0, "font", &font, NULL);
 
-  return pango_context_get_metrics (context,
-                                     font,
-                                     pango_context_get_language (context));
+  retval = pango_context_get_metrics (context,
+                                      font,
+                                      pango_context_get_language (context));
+
+  if (font != NULL)
+    pango_font_description_free (font);
+
+  return retval;
 }
 
 static void



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