[evolution-patches] Re: Fix for http://bugzilla.gnome.org/show_bug.cgi?id=303702



On Fri, 2005-06-24 at 14:41 +0530, Harish Krishnaswamy wrote:
> hi,
> 
>   The patch does prevent the crash but the clone and the ECalChange
> memory is still being leaked, when icalcomponent is NULL.
> 
This time it is fixed.

> Would love if the other FIXME is also taken care of :-)
I too, but, later. :)

V. Varadhan
Index: calendar/conduits/calendar/calendar-conduit.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/conduits/calendar/calendar-conduit.c,v
retrieving revision 1.126
diff -u -p -r1.126 calendar-conduit.c
--- calendar/conduits/calendar/calendar-conduit.c	21 Dec 2004 18:35:10 -0000	1.126
+++ calendar/conduits/calendar/calendar-conduit.c	1 Jul 2005 12:28:43 -0000
@@ -616,9 +616,10 @@ process_multi_day (ECalConduitContext *c
  	old_end_value = dt_end.value;
 	while (!last) {
 		ECalComponent *clone = e_cal_component_clone (ccc->comp);
+		icalcomponent *ical_comp = NULL;
 		char *new_uid = e_cal_component_gen_uid ();
 		struct icaltimetype start_value, end_value;
-		ECalChange *c = g_new0 (ECalChange, 1);
+		ECalChange *c = NULL;
 		
 		if (day_end >= event_end) {
 			day_end = event_end;
@@ -635,9 +636,19 @@ process_multi_day (ECalConduitContext *c
 		dt_end.value = &end_value;
 		e_cal_component_set_dtend (clone, &dt_end);
 
+		e_cal_component_commit_sequence (clone);
+		
 		/* FIXME Error handling */
-		e_cal_create_object (ctxt->client, e_cal_component_get_icalcomponent (clone), NULL, NULL);
+		ical_comp = e_cal_component_get_icalcomponent (clone);
+		if (!ical_comp) {
+			ret = FALSE;
+			g_object_unref (clone);
+			goto cleanup;
+		}
+
+		e_cal_create_object (ctxt->client, ical_comp, NULL, NULL);
 
+		c = g_new0 (ECalChange, 1);
 		c->comp = clone;
 		c->type = E_CAL_CHANGE_ADDED;
 		


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