[bijiben] deserializer: fix small leak on color



commit 788c261a6796dbaacf092e5ab32256716109c942
Author: Pierre-Yves Luyten <py luyten fr>
Date:   Thu Jan 3 19:16:37 2013 +0100

    deserializer: fix small leak on color

 src/libbiji/deserializer/biji-lazy-deserializer.c |   22 +++++++-------------
 1 files changed, 8 insertions(+), 14 deletions(-)
---
diff --git a/src/libbiji/deserializer/biji-lazy-deserializer.c b/src/libbiji/deserializer/biji-lazy-deserializer.c
index 20ab2db..b9b43b2 100644
--- a/src/libbiji/deserializer/biji-lazy-deserializer.c
+++ b/src/libbiji/deserializer/biji-lazy-deserializer.c
@@ -432,10 +432,9 @@ processNode (BijiLazyDeserializer *self)
   xmlTextReaderPtr r = self->priv->r;
   BijiNoteObj * n = self->priv->note;
   xmlChar   *name;
-  GdkRGBA   *color;
-  gchar     *tag;
+  GdkRGBA    color;
+  gchar     *tag, *color_str;
   GString   *norm;
-  gchar     *debug;
 
   name = xmlTextReaderName (r);
 
@@ -469,20 +468,15 @@ processNode (BijiLazyDeserializer *self)
 
   if (g_strcmp0 ((gchar*) name, "color") == 0 )  
   {
-    color = g_new (GdkRGBA,1);
-    debug = (gchar*) xmlTextReaderReadString (r);
+    color_str = (gchar*) xmlTextReaderReadString (r);
 
-    if ( gdk_rgba_parse (color,debug))
-    {
-      biji_note_obj_set_rgba (n, color);
-    }
-    else
-    {
-      g_warning ("color invalid:%s",debug);
-    }
+    if (gdk_rgba_parse (&color, color_str))
+      biji_note_obj_set_rgba (n, &color);
 
-    free (debug);
+    else
+      g_warning ("color invalid:%s", color_str);
 
+    free (color_str);
   }
 
   if ( g_strcmp0((gchar*)name,"tag") == 0 )  



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