[Galago-commits] r2509 - in trunk/eds-feed: . src

galago-commits at freedesktop.org galago-commits at freedesktop.org
Fri Jan 27 11:14:32 PST 2006


Author: chipx86
Date: 2006-01-27 11:14:29 -0800 (Fri, 27 Jan 2006)
New Revision: 2509

Modified:
   trunk/eds-feed/AUTHORS
   trunk/eds-feed/ChangeLog
   trunk/eds-feed/src/main.c
Log:
Patch by Jorn Baayen to fix several memory leaks. This closes bugzilla bug #4490.


Modified: trunk/eds-feed/AUTHORS
===================================================================
--- trunk/eds-feed/AUTHORS	2006-01-27 19:11:20 UTC (rev 2508)
+++ trunk/eds-feed/AUTHORS	2006-01-27 19:14:29 UTC (rev 2509)
@@ -1 +1,8 @@
-Christian Hammond <chipx86 at gnupdate.org>
+Developers:
+
+    Christian Hammond <chipx86 at gnupdate.org>
+
+
+Patch Writers:
+
+	Jorn Baayen - <jorn at openedhand.com>

Modified: trunk/eds-feed/ChangeLog
===================================================================
--- trunk/eds-feed/ChangeLog	2006-01-27 19:11:20 UTC (rev 2508)
+++ trunk/eds-feed/ChangeLog	2006-01-27 19:14:29 UTC (rev 2509)
@@ -1,3 +1,10 @@
+Fri Jan 27 11:13:51 PST 2006  Christian Hammond <chipx86 at chipx86.com>
+
+	* AUTHORS:
+	* src/main.c:
+	  - Patch by Jorn Baayen to fix several memory leaks. This closes
+	    bugzilla bug #4490.
+
 Tue Jan 24 22:55:42 PST 2006  Christian Hammond <chipx86 at chipx86.com>
 
 	* src/main.c:

Modified: trunk/eds-feed/src/main.c
===================================================================
--- trunk/eds-feed/src/main.c	2006-01-27 19:11:20 UTC (rev 2508)
+++ trunk/eds-feed/src/main.c	2006-01-27 19:14:29 UTC (rev 2509)
@@ -35,13 +35,13 @@
 			 GalagoService *service, EContactField field)
 {
 	GalagoAccount *account;
-	GList *im_attr_list, *l;
+	GList *im_attr_list;
 
 	im_attr_list = e_contact_get_attributes(contact, field);
 
-	for (l = im_attr_list; l != NULL; l = l->next)
+        while (im_attr_list)
 	{
-		EVCardAttribute *attr = (EVCardAttribute *)l->data;
+		EVCardAttribute *attr = (EVCardAttribute *)im_attr_list->data;
 		char *username;
 
 		username = e_vcard_attribute_get_value(attr);
@@ -50,6 +50,11 @@
 				  username, galago_service_get_id(service));
 
 		account = galago_service_create_account(service, person, username);
+
+                g_free(username);
+
+                im_attr_list = g_list_delete_link (im_attr_list, im_attr_list);
+                e_vcard_attribute_free(attr);
 	}
 }
 
@@ -76,6 +81,8 @@
 
 			account = galago_service_create_account(service, person, username);
 		}
+
+                g_free(username);
 	}
 
 	for (l = galago_person_get_accounts(person, FALSE);
@@ -83,7 +90,8 @@
 		 l = l_next)
 	{
 		gboolean found = FALSE;
-		const char *username1, *username2;
+		const char *username1;
+                char *username2;
 
 		l_next = l->next;
 
@@ -101,10 +109,12 @@
 			username2 = e_vcard_attribute_get_value(attr);
 
 			if (!strcmp(username1, username2))
-			{
 				found = TRUE;
-				break;
-			}
+
+                        g_free(username2);
+
+                        if (found)
+                                break;
 		}
 
 		if (!found)
@@ -115,6 +125,14 @@
 			g_object_unref(account);
 		}
 	}
+
+        while (im_attr_list)
+        {
+		EVCardAttribute *attr = (EVCardAttribute *)im_attr_list->data;
+
+                im_attr_list = g_list_delete_link (im_attr_list, im_attr_list);
+                e_vcard_attribute_free(attr);
+        }
 }
 
 static void



More information about the galago-commits mailing list