Re: Leak in the save calendar plugin

Kjartan Maraas <[email protected]>
Newsgroups gmane.comp.gnome.evolution.patches
Message-ID <1156241253.30471.4.camel@rivendell>
tor, 17,.08.2006 kl. 08.47 +0200, skrev Kjartan Maraas:
> tor, 17,.08.2006 kl. 11.42 +0530, skrev chenthill:
> > Hi kmaraas,
> > 	Looks good. Please commit. A similar leak is present in the
> > calendar-config.c (calendar_config_check_timezone_set).
> > 
> I'll check it out and send a patch for that too.
> 
Here we go...

Cheers
Kjartan

_______________________________________________
Evolution-patches mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/evolution-patches
calendar-config-leaks.patch (text/x-patch, 2.9 KB)
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/calendar/ChangeLog,v
retrieving revision 1.3106
diff -u -p -r1.3106 ChangeLog
--- ChangeLog	21 Aug 2006 08:06:10 -0000	1.3106
+++ ChangeLog	22 Aug 2006 10:05:58 -0000
@@ -1,3 +1,8 @@
+2006-08-22  Kjartan Maraas  <[email protected]>
+
+	* gui/calendar-component.c (ensure_sources): Plug a leak.
+	* gui/migration.c (create_calendar_sources): Same thing here.
+
 2006-08-21  Chenthill Palanisamy  <[email protected]>
 
 	Fixes #346549
Index: gui/calendar-component.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/calendar-component.c,v
retrieving revision 1.219
diff -u -p -r1.219 calendar-component.c
--- gui/calendar-component.c	7 Aug 2006 14:44:50 -0000	1.219
+++ gui/calendar-component.c	22 Aug 2006 10:05:58 -0000
@@ -235,11 +235,13 @@ ensure_sources (CalendarComponent *compo
 	}
 
 	if (!personal_source) {
+		char *primary_calendar = calendar_config_get_primary_calendar();
+
 		/* Create the default Person addressbook */
 		personal_source = e_source_new (_("Personal"), PERSONAL_RELATIVE_URI);
 		e_source_group_add_source (on_this_computer, personal_source, -1);
-
-		if (!calendar_config_get_primary_calendar () && !calendar_config_get_calendars_selected ()) {
+		
+		if (!primary_calendar && !calendar_config_get_calendars_selected ()) {
 			GSList selected;
 
 			calendar_config_set_primary_calendar (e_source_peek_uid (personal_source));
@@ -248,7 +250,8 @@ ensure_sources (CalendarComponent *compo
 			selected.next = NULL;
 			calendar_config_set_calendars_selected (&selected);
 		}
-		
+
+		g_free (primary_calendar);
 		e_source_set_color (personal_source, 0xBECEDD);
 	}
 
Index: gui/migration.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/migration.c,v
retrieving revision 1.41
diff -u -p -r1.41 migration.c
--- gui/migration.c	12 Jun 2006 11:54:28 -0000	1.41
+++ gui/migration.c	22 Aug 2006 10:05:58 -0000
@@ -478,11 +478,13 @@ create_calendar_sources (CalendarCompone
 	}
 
 	if (!*personal_source) {
+		char *primary_calendar = calendar_config_get_primary_calendar ();
+
 		/* Create the default Person calendar */
 		ESource *source = e_source_new (_("Personal"), PERSONAL_RELATIVE_URI);
 		e_source_group_add_source (*on_this_computer, source, -1);
 		
-		if (!calendar_config_get_primary_calendar () && !calendar_config_get_calendars_selected ()) {
+		if (!primary_calendar && !calendar_config_get_calendars_selected ()) {
 			GSList selected;
 
 			calendar_config_set_primary_calendar (e_source_peek_uid (source));
@@ -491,7 +493,8 @@ create_calendar_sources (CalendarCompone
 			selected.next = NULL;
 			calendar_config_set_calendars_selected (&selected);
 		}
-		
+
+		g_free (primary_calendar);		
 		e_source_set_color (source, 0xBECEDD);
 		*personal_source = source;
 	}
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.