Re: Leak in tny-camel-mime-part



O Luns 17/12/2007 ás 19:53, Philip Van Hoof dicía...

> > > Looks like there's a leak here, as
> > > camel_medium_set_content_object() adds a reference
> > > (camel_medium_get_content_object() doesn't, by the way)
> > 
> > And it seems that there's another one in
> > tny_camel_mime_part_construct_from_stream_default(), it lacks a
> > camel_object_unref (wrapper) at the end of the function.
> 
> Okay, please provide a patch for the second one and send it to this
> mailing list.

I was looking for another one, and I finally found it, this one was
probably the biggest one.

I'm attaching the full patch.

-- 
Alberto García González
http://people.igalia.com/berto/
Index: libtinymail-camel/tny-camel-mime-part.c
===================================================================
--- libtinymail-camel/tny-camel-mime-part.c	(revision 3146)
+++ libtinymail-camel/tny-camel-mime-part.c	(working copy)
@@ -409,6 +409,7 @@
 		g_free (applied_type);
 		camel_multipart_set_boundary (body, NULL);
 		camel_medium_set_content_object (medium, CAMEL_DATA_WRAPPER (body));
+		camel_object_unref (body);
 	} else
 		body = CAMEL_MULTIPART (containee);
 
@@ -719,6 +720,7 @@
 
 	camel_object_unref (cstream);
 	camel_object_unref (medium);
+	camel_object_unref (wrapper);
 
 	return retval;
 }
@@ -748,6 +750,7 @@
 	if (!wrapper) {
 		wrapper = camel_data_wrapper_new (); 
 		camel_medium_set_content_object (medium, wrapper);
+		camel_object_unref (wrapper);
 	} 
 
 	if (wrapper->stream) {
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 3146)
+++ ChangeLog	(working copy)
@@ -1,3 +1,11 @@
+2007-12-17  Alberto Garcia Gonzalez  <agarcia igalia com>
+
+	* libtinymail-camel/tny-camel-mime-part.c
+	(tny_camel_mime_part_add_part_default)
+	(tny_camel_mime_part_get_stream_default)
+	(tny_camel_mime_part_construct_from_stream_default)
+	Fixed three memory leaks
+
 2007-12-15  Philip Van Hoof <pvanhoof gnome org>
 
 	* Moved the TnyFolderStoreQuery parameter in


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