Exchange calendar - Memory leaks

Sushma Rai <[email protected]>
Newsgroups gmane.comp.gnome.evolution.patches
Message-ID <[email protected]>
Hi,

I have attached the patch to fix some memory 
leaks in calendar backend. 
See http://bugzilla.gnome.org/show_bug.cgi?id=329251
for the valgrind reports.

Please review.
Thanks,
Sushma

_______________________________________________
Evolution-patches mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/evolution-patches
memleak-329251-cal.diff (text/x-patch, 2.3 KB)
Index: calendar/e-cal-backend-exchange.c
===================================================================
RCS file: /cvs/gnome/evolution-exchange/calendar/e-cal-backend-exchange.c,v
retrieving revision 1.55
diff -u -p -r1.55 e-cal-backend-exchange.c
--- calendar/e-cal-backend-exchange.c	18 Jan 2006 13:07:41 -0000	1.55
+++ calendar/e-cal-backend-exchange.c	2 Feb 2006 06:43:55 -0000
@@ -382,6 +382,7 @@ open_calendar (ECalBackendSync *backend,
 		if (prop)
 			access = atoi (prop);
 	}
+	e2k_results_free (results, nresults);
 
 	if (!(access & MAPI_ACCESS_READ)) {
 		g_mutex_unlock (cbex->priv->open_lock);
@@ -741,12 +742,13 @@ get_object (ECalBackendSync *backend, ED
 		} else {
 			/* Instance is not found. Send the master object instead */	
 			if (ecomp->icomp) {
-				icalcomponent *new_inst;
+				icalcomponent *temp_inst, *new_inst;
 				struct icaltimetype itt;
 
 				itt = icaltime_from_string (rid);
-				new_inst = e_cal_util_construct_instance (
-					icalcomponent_new_clone (ecomp->icomp), itt);
+				temp_inst = icalcomponent_new_clone (ecomp->icomp);
+				new_inst = e_cal_util_construct_instance (temp_inst, itt);
+				icalcomponent_free (temp_inst);
 				if (!new_inst)
 					return GNOME_Evolution_Calendar_ObjectNotFound;
 				
@@ -1428,8 +1430,8 @@ check_change_type (gpointer key, gpointe
 		}
 		
 		g_free (calobj);
+		g_object_unref (comp);		
 	}
-	g_object_unref (comp);		
 }
 
 struct cbe_data {
Index: calendar/e-cal-backend-exchange-calendar.c
===================================================================
RCS file: /cvs/gnome/evolution-exchange/calendar/e-cal-backend-exchange-calendar.c,v
retrieving revision 1.49
diff -u -p -r1.49 e-cal-backend-exchange-calendar.c
--- calendar/e-cal-backend-exchange-calendar.c	4 Jan 2006 07:38:55 -0000	1.49
+++ calendar/e-cal-backend-exchange-calendar.c	2 Feb 2006 06:49:43 -0000
@@ -214,6 +214,7 @@ add_ical (ECalBackendExchange *cbex, con
 			ecomp = e_cal_component_new ();
 			e_cal_component_set_icalcomponent (ecomp, icalcomponent_new_clone (icalcomp));
 			e_cal_component_set_attachment_list (ecomp, attachment_list);
+			icalcomponent_free (icalcomp);
 			icalcomp = icalcomponent_new_clone (e_cal_component_get_icalcomponent (ecomp));
 			g_object_unref (ecomp);
 		}
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.