Re: [evolution-patches] Patches for leaks in evolution



tir, 12,.07.2005 kl. 09.44 +0800, skrev Not Zed:
> On Fri, 2005-07-08 at 20:43 +0200, Kjartan Maraas wrote:
> > 
> > > In normal processing this value gets transferred to the message list
> > > search pointer, i guess it only leaks if the processing gets
> > cancelled.
> > > 
> > > You should also add a m->search = NULL in regen_list_regened() after
> > the
> > > pointer gets transferred to the messagelist to avoid a double-free
> > or
> > > worse.
> > > 
> > > Should be ok with that + ready to commit.
> > > 
> > I tried wrapping my head around that but failed. Could you show me
> > where
> > exactly you mean? 
> 
>         if (m->ml->search && m->ml->search != m->search)
>                 g_free (m->ml->search);
> 	m->ml->search = m->search;
> 
> 
> There ^^
> 
> it sets the search directly on the messagelist.  So m->search should
> just be set to NULL directly after, if it is to be freed in the free()
> func.
> 
Sorry for being slow, I got stuff mixed up here. Attaching a final
iteration of the patch here.

Cheers
Kjartan

? addressbook/addressbook.error
? calendar/calendar.error
? calendar/gui/apps_evolution_calendar-2.4.schemas
? composer/mail-composer.error
? e-util/e-system.error
? filter/filter.error
? help/C/evolution-2.4-C.omf
? help/C/evolution-2.4.xml
? mail/Evolution-Mail-common.c
? mail/Evolution-Mail-skels.c
? mail/Evolution-Mail-stubs.c
? mail/Evolution-Mail.h
? mail/evolution-mail-2.4.schemas
? mail/mail.error
? mail/search
? mail/default/zh_CN/Makefile
? mail/default/zh_CN/Makefile.in
? plugins/addressbook-file/Makefile
? plugins/addressbook-file/Makefile.in
? plugins/addressbook-file/org-gnome-addressbook-file.eplug
? plugins/default-mailer/Makefile
? plugins/default-mailer/Makefile.in
? plugins/default-mailer/apps-evolution-mail-prompts-checkdefault-2.4.schemas
? plugins/default-mailer/org-gnome-default-mailer.eplug
? plugins/default-mailer/org-gnome-default-mailer.error
? plugins/default-source/Makefile
? plugins/default-source/Makefile.in
? plugins/default-source/org-gnome-default-source.eplug
? plugins/exchange-account-setup/Makefile
? plugins/exchange-account-setup/Makefile.in
? plugins/exchange-account-setup/org-gnome-exchange-account-setup.eplug
? plugins/exchange-operations/Makefile
? plugins/exchange-operations/Makefile.in
? plugins/groupwise-features/Makefile
? plugins/groupwise-features/Makefile.in
? plugins/groupwise-features/org-gnome-groupwise-features.eplug
? plugins/itip-formatter/org-gnome-itip-formatter.error
? plugins/mail-remote/Makefile
? plugins/mail-remote/Makefile.in
? plugins/mailing-list-actions/org-gnome-mailing-list-actions.error
? plugins/mark-all-read/Makefile
? plugins/mark-all-read/Makefile.in
? plugins/mark-all-read/org-gnome-mark-all-read.eplug
? plugins/mono/Makefile
? plugins/mono/Makefile.in
? plugins/new-mail-notify/Makefile
? plugins/new-mail-notify/Makefile.in
? plugins/new-mail-notify/org-gnome-new-mail-notify.eplug
? plugins/print-message/Makefile
? plugins/print-message/Makefile.in
? plugins/print-message/org-gnome-print-message.eplug
? plugins/profiler/Makefile
? plugins/profiler/Makefile.in
? shell/shell.error
? shell/importer/GNOME_Evolution_Importer-common.c
? shell/importer/GNOME_Evolution_Importer-skels.c
? shell/importer/GNOME_Evolution_Importer-stubs.c
? shell/importer/GNOME_Evolution_Importer.h
? shell/importer/Makefile
? shell/importer/Makefile.in
? win32/Makefile
? win32/Makefile.in
Index: calendar/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/calendar/ChangeLog,v
retrieving revision 1.2769
diff -u -p -r1.2769 ChangeLog
--- calendar/ChangeLog	12 Jul 2005 13:55:38 -0000	1.2769
+++ calendar/ChangeLog	13 Jul 2005 09:24:28 -0000
@@ -1,3 +1,10 @@
+2005-07-08  Kjartan Maraas  <kmaraas gnome org>
+
+	* gui/alarm-notify/alarm-notify.c: (alarm_notify_add_calendar):
+	Free the uri to the source in a few cases. 
+	* gui/calendar-config.c: (calendar_config_get_icaltimezone):
+	Free the timezone location.
+
 2005-07-12  Chenthill Palanisamy  <pchenthill novell com>
 
 	* gui/e-meeting-list-view.c: 
Index: calendar/gui/calendar-config.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/calendar-config.c,v
retrieving revision 1.76
diff -u -p -r1.76 calendar-config.c
--- calendar/gui/calendar-config.c	17 Jun 2005 15:20:27 -0000	1.76
+++ calendar/gui/calendar-config.c	13 Jul 2005 09:24:29 -0000
@@ -195,9 +195,10 @@ calendar_config_get_icaltimezone (void)
 	calendar_config_init ();
 	
 	location = calendar_config_get_timezone ();
-	if (location)
+	if (location) {
 		zone = icaltimezone_get_builtin_timezone (location);
-
+		g_free (location);
+	}
 	if (!zone)
 		zone = icaltimezone_get_utc_timezone ();
 	
Index: calendar/gui/alarm-notify/alarm-notify.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/alarm-notify/alarm-notify.c,v
retrieving revision 1.50
diff -u -p -r1.50 alarm-notify.c
--- calendar/gui/alarm-notify/alarm-notify.c	9 May 2005 09:10:38 -0000	1.50
+++ calendar/gui/alarm-notify/alarm-notify.c	13 Jul 2005 09:24:29 -0000
@@ -338,6 +338,7 @@ alarm_notify_add_calendar (AlarmNotify *
 	/* See if we already know about this uri */
 	if (g_hash_table_lookup (priv->uri_client_hash[source_type], str_uri)) {
 		g_mutex_unlock (an->priv->mutex);
+		g_free (str_uri);
 		return;
 	}
 	/* if loading of this requires password and password is not currently availble in e-password
@@ -346,6 +347,7 @@ alarm_notify_add_calendar (AlarmNotify *
 	if ((e_source_get_property (source, "auth") && 
 	     (!e_passwords_get_password (e_source_get_property(source, "auth-domain"), str_uri)))) {
 		g_mutex_unlock (an->priv->mutex);
+		g_free (str_uri);
 		return;
 	}
 	client = auth_new_cal_from_source (source, source_type);
@@ -355,6 +357,7 @@ alarm_notify_add_calendar (AlarmNotify *
 		g_signal_connect (G_OBJECT (client), "cal_opened", G_CALLBACK (cal_opened_cb), an);
 		e_cal_open_async (client, FALSE);
 	}
+	g_free (str_uri);
 	g_mutex_unlock (an->priv->mutex);
 }
 
Index: composer/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/composer/ChangeLog,v
retrieving revision 1.702
diff -u -p -r1.702 ChangeLog
--- composer/ChangeLog	11 Jul 2005 11:26:31 -0000	1.702
+++ composer/ChangeLog	13 Jul 2005 09:24:30 -0000
@@ -1,3 +1,9 @@
+2005-07-07  Kjartan Maraas  <kmaraas gnome org>
+
+	* e-msg-composer-select-file.c: (select_attach_response): Don't
+	leak the file name here.
+	* e-msg-composer.c: (build_message): Don't allocate charset twice.
+
 2005-07-11  Srinivasa Ragavan <sragavan novell com>
 
 	* Makefile.am: Removed em-attachment* from the build.
@@ -10,6 +16,7 @@
 	Changed the code to use e_attachment_* from em_attachment*
 
 	* e-msg-composer.h: Added removed old header includes
+
 2005-07-10  Shreyas Srinivasan <sshreyas novell com>
 
 	* e-msg-composer-hdrs.c: Take into account store
Index: composer/e-msg-composer-select-file.c
===================================================================
RCS file: /cvs/gnome/evolution/composer/e-msg-composer-select-file.c,v
retrieving revision 1.35
diff -u -p -r1.35 e-msg-composer-select-file.c
--- composer/e-msg-composer-select-file.c	3 Jun 2005 04:20:57 -0000	1.35
+++ composer/e-msg-composer-select-file.c	13 Jul 2005 09:24:32 -0000
@@ -194,8 +194,11 @@ select_attach_response(GtkWidget *select
 		char *path;
 
 #ifdef USE_GTKFILECHOOSER
+		char *filename;
 		names = gtk_file_chooser_get_filenames (GTK_FILE_CHOOSER (selector));
-		path = g_path_get_dirname (gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (selector)));
+		filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (selector));
+		path = g_path_get_dirname (filename);
+		g_free (filename);
 #else
 		char **files;
 		int i;
Index: composer/e-msg-composer.c
===================================================================
RCS file: /cvs/gnome/evolution/composer/e-msg-composer.c,v
retrieving revision 1.513
diff -u -p -r1.513 e-msg-composer.c
--- composer/e-msg-composer.c	11 Jul 2005 11:26:31 -0000	1.513
+++ composer/e-msg-composer.c	13 Jul 2005 09:24:34 -0000
@@ -492,7 +492,7 @@ build_message (EMsgComposer *composer, g
 		}
 		
 		/* FIXME: we may want to do better than this... */
-		charset = best_charset (data, composer->charset, &plain_encoding);
+
 		type = camel_content_type_new ("text", "plain");
 		if ((charset = best_charset (data, composer->charset, &plain_encoding))) {
 			camel_content_type_set_param (type, "charset", charset);
Index: mail/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/mail/ChangeLog,v
retrieving revision 1.3654
diff -u -p -r1.3654 ChangeLog
--- mail/ChangeLog	12 Jul 2005 04:04:12 -0000	1.3654
+++ mail/ChangeLog	13 Jul 2005 09:24:43 -0000
@@ -1,3 +1,12 @@
+2005-07-13  Kjartan Maraas  <kmaraas gnome org>
+
+	* em-mailer-prefs.c: (em_mailer_prefs_construct): Free font name
+	* mail-config.c: (config_write_style): Free font name and name
+	  of citation color.
+	* message-list.c: (regen_list_regened), (regen_list_free): Free
+	  search string. Thanks to Michael Zucchi for walking me through
+	  this one. My brain wasn't running on all it's cylinders...
+
 2005-07-10  Shreyas Srinivasan <sshreyas novell com>
 
 	* mail-config.[ch]: Add new functions to remove proxy accounts and
Index: mail/em-mailer-prefs.c
===================================================================
RCS file: /cvs/gnome/evolution/mail/em-mailer-prefs.c,v
retrieving revision 1.30
diff -u -p -r1.30 em-mailer-prefs.c
--- mail/em-mailer-prefs.c	23 Jun 2005 09:11:06 -0000	1.30
+++ mail/em-mailer-prefs.c	13 Jul 2005 09:24:43 -0000
@@ -814,6 +814,7 @@ em_mailer_prefs_construct (EMMailerPrefs
 	font = gconf_client_get_string (prefs->gconf, "/apps/evolution/mail/display/fonts/variable", NULL);
 	prefs->font_variable = GNOME_FONT_PICKER (glade_xml_get_widget (gui, "FontVariable"));
 	gnome_font_picker_set_font_name (prefs->font_variable, font);
+	g_free (font);
 	g_object_set_data ((GObject *) prefs->font_variable, "key", "/apps/evolution/mail/display/fonts/variable");
 	g_signal_connect (prefs->font_variable, "font-set", G_CALLBACK (font_changed), prefs);
 	if (!gconf_client_key_is_writable (prefs->gconf, "/apps/evolution/mail/display/fonts/variable", NULL))
Index: mail/mail-config.c
===================================================================
RCS file: /cvs/gnome/evolution/mail/mail-config.c,v
retrieving revision 1.318
diff -u -p -r1.318 mail-config.c
--- mail/mail-config.c	10 Jul 2005 10:03:56 -0000	1.318
+++ mail/mail-config.c	13 Jul 2005 09:24:44 -0000
@@ -249,6 +249,7 @@ config_write_style (void)
 	gboolean custom;
 	char *fix_font;
 	char *var_font;
+	char *citation_color;
 	FILE *rc;
 	
 	if (!(rc = fopen (config->gtkrc, "wt"))) {
@@ -259,7 +260,7 @@ config_write_style (void)
 	custom = gconf_client_get_bool (config->gconf, "/apps/evolution/mail/display/fonts/use_custom", NULL);
 	var_font = gconf_client_get_string (config->gconf, "/apps/evolution/mail/display/fonts/variable", NULL);
 	fix_font = gconf_client_get_string (config->gconf, "/apps/evolution/mail/display/fonts/monospace", NULL);
-
+	citation_color = gconf_client_get_string (config->gconf, "/apps/evolution/mail/display/citation_colour", NULL);
  	CONFIG_GET_SPELL_VALUE (int, "/spell_error_color_red",   red, (void)0, (int));
  	CONFIG_GET_SPELL_VALUE (int, "/spell_error_color_green", green, (void)0, (int));
  	CONFIG_GET_SPELL_VALUE (int, "/spell_error_color_blue",  blue, (void)0, (int));
@@ -270,7 +271,8 @@ config_write_style (void)
 
 	if (gconf_client_get_bool (config->gconf, "/apps/evolution/mail/display/mark_citations", NULL))
 		fprintf (rc, "        GtkHTML::cite_color = \"%s\"\n",
-			 gconf_client_get_string (config->gconf, "/apps/evolution/mail/display/citation_colour", NULL));
+			 citation_color);
+	g_free (citation_color);
 
 	if (custom && var_font && fix_font) {
 		fprintf (rc,
@@ -278,6 +280,9 @@ config_write_style (void)
 			 "        font_name = \"%s\"\n",
 			 fix_font, var_font); 
 	}
+	g_free (fix_font);
+	g_free (var_font);
+
 	fprintf (rc, "}\n\n");
 	
 	fprintf (rc, "widget \"*.EMFolderView.*.GtkHTML\" style \"evolution-mail-custom-fonts\"\n");
Index: mail/message-list.c
===================================================================
RCS file: /cvs/gnome/evolution/mail/message-list.c,v
retrieving revision 1.417
diff -u -p -r1.417 message-list.c
--- mail/message-list.c	23 Jun 2005 09:11:07 -0000	1.417
+++ mail/message-list.c	13 Jul 2005 09:24:45 -0000
@@ -3587,6 +3587,7 @@ regen_list_regened (struct _mail_msg *mm
         if (m->ml->search && m->ml->search != m->search)
                 g_free (m->ml->search);
 	m->ml->search = m->search;
+	m->search = NULL;
 
 	m->ml->regen = g_list_remove(m->ml->regen, m);
 
@@ -3618,6 +3619,7 @@ regen_list_free (struct _mail_msg *mm)
 	if (m->tree)
 		camel_folder_thread_messages_unref (m->tree);
 	
+	g_free (m->search);
 	g_free (m->hideexpr);
 	
 	camel_object_unref (m->folder);
Index: shell/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/shell/ChangeLog,v
retrieving revision 1.1528
diff -u -p -r1.1528 ChangeLog
--- shell/ChangeLog	12 Jul 2005 04:04:13 -0000	1.1528
+++ shell/ChangeLog	13 Jul 2005 09:24:48 -0000
@@ -1,3 +1,7 @@
+2005-07-07  Kjartan Maraas  <kmaraas gnome org>
+
+	* e-shell-window.c: (setup_widgets): Free the style here.
+
 2005-07-06  Not Zed  <NotZed Ximian com>
 
 	* e-shell-importer.c (import_druid_finish): now setup a window to
Index: shell/e-shell-window.c
===================================================================
RCS file: /cvs/gnome/evolution/shell/e-shell-window.c,v
retrieving revision 1.34
diff -u -p -r1.34 e-shell-window.c
--- shell/e-shell-window.c	16 May 2005 04:46:40 -0000	1.34
+++ shell/e-shell-window.c	13 Jul 2005 09:24:48 -0000
@@ -670,6 +670,7 @@ setup_widgets (EShellWindow *window)
 		
 		e_sidebar_set_mode (E_SIDEBAR (priv->sidebar), mode);
 	}
+	g_free (style);
 
 	/* The tool bar */
 	visible = gconf_client_get_bool (gconf_client,


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