evolution-data-server r8364 - trunk/camel



Author: pvanhoof
Date: Mon Jan 14 15:16:33 2008
New Revision: 8364
URL: http://svn.gnome.org/viewvc/evolution-data-server?rev=8364&view=rev

Log:
2008-01-14  Philip Van Hoof  <pvanhoof gnome org>

        * camel-multipart.c: Small memory leak fix



Modified:
   trunk/camel/camel-multipart.c

Modified: trunk/camel/camel-multipart.c
==============================================================================
--- trunk/camel/camel-multipart.c	(original)
+++ trunk/camel/camel-multipart.c	Mon Jan 14 15:16:33 2008
@@ -58,7 +58,6 @@
 static const gchar *         get_boundary      (CamelMultipart *multipart);
 static ssize_t               write_to_stream   (CamelDataWrapper *data_wrapper,
 						CamelStream *stream);
-static void                  unref_part        (gpointer data, gpointer user_data);
 
 static int construct_from_parser(CamelMultipart *multipart, struct _CamelMimeParser *mp);
 
@@ -105,6 +104,7 @@
 
 	camel_data_wrapper_set_mime_type (CAMEL_DATA_WRAPPER (multipart),
 					  "multipart/mixed");
+	multipart->parts = NULL;
 	multipart->preface = NULL;
 	multipart->postface = NULL;
 }
@@ -114,10 +114,14 @@
 {
 	CamelMultipart *multipart = CAMEL_MULTIPART (object);
 
-	g_list_foreach (multipart->parts, unref_part, NULL);
+	g_list_foreach (multipart->parts, (GFunc) camel_object_unref, NULL);
+
+	if (multipart->parts)
+		g_list_free (multipart->parts);
 
 	/*if (multipart->boundary)
 	  g_free (multipart->boundary);*/
+
 	if (multipart->preface)
 		g_free (multipart->preface);
 	if (multipart->postface)
@@ -143,13 +147,6 @@
 	return camel_multipart_type;
 }
 
-static void
-unref_part (gpointer data, gpointer user_data)
-{
-	CamelObject *part = data;
-
-	camel_object_unref (part);
-}
 
 /**
  * camel_multipart_new:



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