[libgdata] [core] Fix a memory leak in an unlikely error condition



commit 4575caa4b181db863d2c31dd29644588df76d661
Author: Philip Withnall <philip withnall collabora co uk>
Date:   Sat Aug 7 12:14:17 2010 +0100

    [core] Fix a memory leak in an unlikely error condition

 gdata/gdata-parsable.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
---
diff --git a/gdata/gdata-parsable.c b/gdata/gdata-parsable.c
index 87a3bfb..37622ba 100644
--- a/gdata/gdata-parsable.c
+++ b/gdata/gdata-parsable.c
@@ -220,8 +220,10 @@ _gdata_parsable_new_from_xml_node (GType parsable_type, xmlDoc *doc, xmlNode *no
 	parsable = g_object_new (parsable_type, NULL);
 
 	klass = GDATA_PARSABLE_GET_CLASS (parsable);
-	if (klass->parse_xml == NULL)
+	if (klass->parse_xml == NULL) {
+		g_object_unref (parsable);
 		return NULL;
+	}
 
 	g_assert (klass->element_name != NULL);
 	/* TODO: See gdata-documents-entry.c:260 for an example of where the code below doesn't work */



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