Patch: fix a small ref leak in TnyCamelFolder copy_shared



	Hi,

	This should fix a small leak in tny_camel_folder_copy_shared. Patch is
contributed by Qasim Ahmad.

Changelog entry:
* libtinymail-camel/tny-camel-folder.c: leak fix in TnyCamelFolder
  copy_shared implementation (contributed by Qashim Ahmad).


-- 
José Dapena Paz <jdapena igalia com>
Igalia
diff --git a/ChangeLog b/ChangeLog
index f81593b..7c2251d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2009-01-09  Jose Dapena Paz  <jdapena igalia com>
+
+	* libtinymail-camel/tny-camel-folder.c: leak fix in TnyCamelFolder
+	copy_shared implementation (contributed by Qashim Ahmad).
+
 2009-01-08  Jose Dapena Paz  <jdapena igalia com>
 
 	* libtinymail-camel/camel-lite/camel/providers/imap/camel-imap-store.c:
diff --git a/libtinymail-camel/tny-camel-folder.c b/libtinymail-camel/tny-camel-folder.c
index 5852094..be1ae55 100644
--- a/libtinymail-camel/tny-camel-folder.c
+++ b/libtinymail-camel/tny-camel-folder.c
@@ -3549,7 +3549,14 @@ tny_camel_folder_copy_shared (TnyFolder *self, TnyFolderStore *into, const gchar
 						if (!rpriv->folder_name || strlen (rpriv->folder_name) <= 0)
 							rpriv->folder_name = g_strdup (to);
 						_tny_camel_folder_set_parent (TNY_CAMEL_FOLDER (retval), into);
-						rpriv->folder = NULL; /* This might be a leak */
+												
+						if (G_LIKELY (rpriv->folder) && CAMEL_IS_FOLDER (rpriv->folder))
+							{
+								if (rpriv->folder_changed_id != 0)
+  									camel_object_remove_event (rpriv->folder, rpriv->folder_changed_id);
+							 	camel_object_unref (CAMEL_OBJECT (rpriv->folder));
+							}
+						rpriv->folder = NULL;
 					} 
 				}
 


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