evolution-data-server r8422 - in trunk/calendar: . backends/google backends/groupwise



Author: mcrha
Date: Fri Jan 25 12:34:37 2008
New Revision: 8422
URL: http://svn.gnome.org/viewvc/evolution-data-server?rev=8422&view=rev

Log:
2008-01-25  Milan Crha  <mcrha redhat com>

	** Fix for bug #510409

	* backends/groupwise/e-cal-backend-groupwise.c: (get_deltas),
	(e_cal_backend_groupwise_remove_object), (receive_object):
	* backends/google/e-cal-backend-google-utils.c:
	(e_cal_backend_google_utils_populate_cache):
	* backends/google/e-cal-backend-google.c:
	(e_cal_backend_google_remove_object):
	Do not leak after call of e_cal_component_get_as_string.



Modified:
   trunk/calendar/ChangeLog
   trunk/calendar/backends/google/e-cal-backend-google-utils.c
   trunk/calendar/backends/google/e-cal-backend-google.c
   trunk/calendar/backends/groupwise/e-cal-backend-groupwise.c

Modified: trunk/calendar/backends/google/e-cal-backend-google-utils.c
==============================================================================
--- trunk/calendar/backends/google/e-cal-backend-google-utils.c	(original)
+++ trunk/calendar/backends/google/e-cal-backend-google-utils.c	Fri Jan 25 12:34:37 2008
@@ -113,6 +113,7 @@
 			e_cal_backend_notify_object_created (E_CAL_BACKEND(cbgo), (const char *)comp_str);
 			e_cal_backend_cache_put_component (cache, comp);
 			g_object_unref (comp);
+			g_free (comp_str);
 		}
 	}
 

Modified: trunk/calendar/backends/google/e-cal-backend-google.c
==============================================================================
--- trunk/calendar/backends/google/e-cal-backend-google.c	(original)
+++ trunk/calendar/backends/google/e-cal-backend-google.c	Fri Jan 25 12:34:37 2008
@@ -620,11 +620,16 @@
 		ECalBackendSyncStatus status;
 		icalcomponent *icalcomp;
 		ECalComponentId *id;
+		char *comp_str;
 
 		status = e_cal_backend_google_get_object (backend, cal, uid, rid, &calobj);
 
-		if (status != GNOME_Evolution_Calendar_Success)
+		if (status != GNOME_Evolution_Calendar_Success) {
+			g_free (calobj);
+			if (entries)
+				g_slist_free (entries);
 			return status;
+		}
 
 		comp = e_cal_backend_cache_get_component (priv->cache, uid, rid);
 		id = e_cal_component_get_id (comp);
@@ -633,21 +638,28 @@
 
 		if (!icalcomp) {
 			g_free (calobj);
+			if (entries)
+				g_slist_free (entries);
 			return GNOME_Evolution_Calendar_InvalidObject;
 		}
 
+		comp_str = e_cal_component_get_as_string (comp);
 		e_cal_backend_cache_remove_component (priv->cache, uid, rid);
-		e_cal_backend_notify_object_removed (E_CAL_BACKEND (cbgo), id, e_cal_component_get_as_string (comp), NULL);
+		e_cal_backend_notify_object_removed (E_CAL_BACKEND (cbgo), id, comp_str, NULL);
+		g_free (comp_str);
 
 		entry = gdata_entry_get_entry_by_id (entries, uid);
 
-		if (!entry)
+		if (!entry) {
+			g_free (calobj);
+			if (entries)
+				g_slist_free (entries);
 			return GNOME_Evolution_Calendar_InvalidObject;
+		}
 
 	        gdata_service_delete_entry (GDATA_SERVICE(priv->service), entry);
 		*object = NULL;
 		*old_object = strdup (calobj);
-
 	}
 
 	if (calobj)

Modified: trunk/calendar/backends/groupwise/e-cal-backend-groupwise.c
==============================================================================
--- trunk/calendar/backends/groupwise/e-cal-backend-groupwise.c	(original)
+++ trunk/calendar/backends/groupwise/e-cal-backend-groupwise.c	Fri Jan 25 12:34:37 2008
@@ -409,7 +409,7 @@
 	for (; item_list != NULL; item_list = g_list_next(item_list)) {
 		EGwItem *item = NULL;
 		ECalComponent *modified_comp = NULL, *cache_comp = NULL;
-		char *cache_comp_str = NULL;
+		char *cache_comp_str = NULL, *modif_comp_str;
 		const char *uid, *rid = NULL;
 		int r_key;
 
@@ -428,7 +428,9 @@
 		e_cal_component_commit_sequence (cache_comp);
 
 		cache_comp_str = e_cal_component_get_as_string (cache_comp);
-		e_cal_backend_notify_object_modified (E_CAL_BACKEND (cbgw), cache_comp_str, e_cal_component_get_as_string (modified_comp));
+		modif_comp_str = e_cal_component_get_as_string (modified_comp);
+		e_cal_backend_notify_object_modified (E_CAL_BACKEND (cbgw), cache_comp_str, modif_comp_str);
+		g_free (modif_comp_str);
 		g_free (cache_comp_str);
 		cache_comp_str = NULL;
 		e_cal_backend_cache_put_component (cache, modified_comp);
@@ -2209,8 +2211,11 @@
 
 					e_cal_backend_cache_remove_component (priv->cache, id->uid,
 							id->rid);
-					if (!id->rid || !g_str_equal (id->rid, rid))
-						e_cal_backend_notify_object_removed (E_CAL_BACKEND (cbgw), id, e_cal_component_get_as_string (comp), NULL);
+					if (!id->rid || !g_str_equal (id->rid, rid)) {
+						char *comp_str = e_cal_component_get_as_string (comp);
+						e_cal_backend_notify_object_removed (E_CAL_BACKEND (cbgw), id, comp_str, NULL);
+						g_free (comp_str);
+					}
 					e_cal_component_free_id (id);
 
 					g_object_unref (comp);
@@ -2429,12 +2434,12 @@
 				ECalComponentId *id = e_cal_component_get_id (component);
 
 				if (e_cal_backend_cache_remove_component (priv->cache, id->uid, id->rid)) {
-
-					e_cal_backend_notify_object_removed (E_CAL_BACKEND (cbgw), id, e_cal_component_get_as_string (component), NULL);
-				e_cal_component_free_id (id);
-
+					char *comp_str = e_cal_component_get_as_string (component);
+					e_cal_backend_notify_object_removed (E_CAL_BACKEND (cbgw), id, comp_str, NULL);
+					g_free (comp_str);
 				}
 
+				e_cal_component_free_id (id);
 			} else {
 				char *comp_str = NULL;
 
@@ -2558,9 +2563,8 @@
 						ECalComponentId *cid = e_cal_component_get_id (component);
 						char *object = e_cal_component_get_as_string (component);
 
-						if (e_cal_backend_cache_remove_component (priv->cache, cid->uid,
-								cid->rid))
-						e_cal_backend_notify_object_removed (E_CAL_BACKEND (cbgw), cid, object, NULL);
+						if (e_cal_backend_cache_remove_component (priv->cache, cid->uid, cid->rid))
+							e_cal_backend_notify_object_removed (E_CAL_BACKEND (cbgw), cid, object, NULL);
 
 						e_cal_component_free_id (cid);
 						g_free (object);



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