[evolution-patches] patch for a memory leak in eds [calendar]



hi,
    Have attached a patch to free the strings and unref the component
wherever necessary.

thanks, chenthill
? patch_meml.diff
? send-options_not
? backends/groupwise/.e-cal-backend-groupwise.c.swp
? libecal/.e-cal.c.swp
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution-data-server/calendar/ChangeLog,v
retrieving revision 1.351
diff -u -p -r1.351 ChangeLog
--- ChangeLog	19 Nov 2004 20:00:59 -0000	1.351
+++ ChangeLog	1 Dec 2004 15:15:25 -0000
@@ -1,3 +1,12 @@
+2004-12-01  Chenthill Palanisamy <pchenthill novell com>
+
+	* backends/groupwise/e-cal-backend-groupwise.c:
+	(receive_object): Freed the string variables and unref the 
+	components.
+	* backends/groupwise/e-cal-backend-groupwise-utils.c:
+	(e_gw_connection_get_freebusy_info): Need not use strdup here.
+	
+
 2004-11-18 Sivaiah Nallagatla <snallagatla novell com>
 
 	* backends/groupwise/e-cal-backend-groupwise.c 
Index: backends/file/e-cal-backend-file.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/calendar/backends/file/e-cal-backend-file.c,v
retrieving revision 1.36
diff -u -p -r1.36 e-cal-backend-file.c
--- backends/file/e-cal-backend-file.c	28 Oct 2004 00:16:21 -0000	1.36
+++ backends/file/e-cal-backend-file.c	1 Dec 2004 15:15:26 -0000
@@ -2295,6 +2295,7 @@ e_cal_backend_file_class_init (ECalBacke
 	sync_class->remove_object_sync = e_cal_backend_file_remove_object;
 	sync_class->discard_alarm_sync = e_cal_backend_file_discard_alarm;
 	sync_class->receive_objects_sync = e_cal_backend_file_receive_objects;
+	
 	sync_class->send_objects_sync = e_cal_backend_file_send_objects;
  	sync_class->get_default_object_sync = e_cal_backend_file_get_default_object;
 	sync_class->get_object_sync = e_cal_backend_file_get_object;
Index: backends/groupwise/e-cal-backend-groupwise-utils.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/calendar/backends/groupwise/e-cal-backend-groupwise-utils.c,v
retrieving revision 1.38
diff -u -p -r1.38 e-cal-backend-groupwise-utils.c
--- backends/groupwise/e-cal-backend-groupwise-utils.c	15 Oct 2004 07:04:50 -0000	1.38
+++ backends/groupwise/e-cal-backend-groupwise-utils.c	1 Dec 2004 15:15:26 -0000
@@ -1099,7 +1099,7 @@ e_gw_connection_get_freebusy_info (EGwCo
 		}
 
 		e_cal_component_commit_sequence (comp);
-		*freebusy = g_list_append (*freebusy, g_strdup (e_cal_component_get_as_string (comp)));
+		*freebusy = g_list_append (*freebusy, e_cal_component_get_as_string (comp));
 		g_object_unref (comp);
 	}
 
Index: backends/groupwise/e-cal-backend-groupwise.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/calendar/backends/groupwise/e-cal-backend-groupwise.c,v
retrieving revision 1.105
diff -u -p -r1.105 e-cal-backend-groupwise.c
--- backends/groupwise/e-cal-backend-groupwise.c	19 Nov 2004 20:00:59 -0000	1.105
+++ backends/groupwise/e-cal-backend-groupwise.c	1 Dec 2004 15:15:26 -0000
@@ -1494,8 +1494,10 @@ receive_object (ECalBackendGroupwise *cb
 	
 	status = e_gw_connection_send_appointment (cbgw, priv->container_id, comp, method, &remove, &modif_comp);
 
-	if (status == E_GW_CONNECTION_STATUS_OK && !modif_comp)
+	if (status == E_GW_CONNECTION_STATUS_OK && !modif_comp) {
+		g_object_unref (comp);
 		return GNOME_Evolution_Calendar_Success;
+	}
 
 	/* update the cache */
 	if (status == E_GW_CONNECTION_STATUS_OK) {
@@ -1505,10 +1507,9 @@ receive_object (ECalBackendGroupwise *cb
 			e_cal_component_get_uid (comp, (const char **) &uid);
 			e_cal_backend_cache_remove_component (priv->cache, uid, NULL);
 			e_cal_backend_notify_object_removed (E_CAL_BACKEND (cbgw), uid, e_cal_component_get_as_string (comp));
-			g_free (comp);
 		}
 		else {
-			char *cache_comp = NULL, *temp;
+			char *cache_comp = NULL, *temp, *new_comp = NULL;
 			ECalComponent *cache_component;
 			
 			e_cal_component_commit_sequence (modif_comp);
@@ -1521,23 +1522,26 @@ receive_object (ECalBackendGroupwise *cb
 			}
 
 			e_cal_backend_cache_put_component (priv->cache, modif_comp);	
-			
+			e_cal_component_commit_sequence (modif_comp);
+			new_comp = e_cal_component_get_as_string (modif_comp);
+
 			if (cache_comp)
-				e_cal_backend_notify_object_modified (E_CAL_BACKEND (cbgw), cache_comp, e_cal_component_get_as_string (modif_comp));
+				e_cal_backend_notify_object_modified (E_CAL_BACKEND (cbgw), cache_comp, new_comp);
 			else
-				e_cal_backend_notify_object_created (E_CAL_BACKEND (cbgw), e_cal_component_get_as_string (modif_comp));
+				e_cal_backend_notify_object_created (E_CAL_BACKEND (cbgw), new_comp);
 				
 			g_free (cache_comp);
-			g_free (modif_comp);
+			g_free (new_comp);
 			g_free (temp);
-			g_free (cache_component);
 		}
-		
+		g_object_unref (comp);	
 		return GNOME_Evolution_Calendar_Success;
 	}
 
-	if (status == E_GW_CONNECTION_STATUS_INVALID_OBJECT)
+	if (status == E_GW_CONNECTION_STATUS_INVALID_OBJECT) {
+		g_object_unref (comp);
 		return  GNOME_Evolution_Calendar_InvalidObject;
+	}
 	return GNOME_Evolution_Calendar_OtherError;
 }
 


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