[evolution-patches] [E-Plugin] Memory leak fixes



Hi,

Attached is a patch that fixes few memory leaks that I found in my
valgrind runs.

Let me know you review comments

TIA,

V. Varadhan

P.S:- Patch is created against HEAD and may (or not) apply for 2.4.1.
Would appreciate a mail if you want it for 2.4.1 as well. 
? mem-leaks-eutil-fix.diff
? mem-leaks.diff
? 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/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-operations/Makefile
? plugins/exchange-operations/Makefile.in
? plugins/exchange-operations/org-gnome-exchange-operations.eplug
? plugins/exchange-operations/org-gnome-exchange-operations.error
? plugins/groupwise-account-setup/Makefile
? plugins/groupwise-account-setup/Makefile.in
? plugins/groupwise-account-setup/org-gnome-gw-account-setup.eplug
? 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-account-disable/Makefile
? plugins/mail-account-disable/Makefile.in
? plugins/mail-account-disable/org-gnome-mail-account-disable.eplug
? plugins/mail-remote/Evolution-common.c
? plugins/mail-remote/Evolution-skels.c
? plugins/mail-remote/Evolution-stubs.c
? plugins/mail-remote/Evolution.h
? 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
? plugins/sa-junk-plugin/Makefile
? plugins/sa-junk-plugin/Makefile.in
? plugins/sa-junk-plugin/org-gnome-sa-junk-plugin.eplug
? shell/shell.error
? win32/Makefile
? win32/Makefile.in
Index: e-util/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/e-util/ChangeLog,v
retrieving revision 1.554
diff -u -p -r1.554 ChangeLog
--- e-util/ChangeLog	24 Aug 2005 03:05:59 -0000	1.554
+++ e-util/ChangeLog	26 Sep 2005 07:38:07 -0000
@@ -1,3 +1,7 @@
+2005-09-26  Veerapuram Varadhan <vvaradhan novell com>
+
+	* e-plugin.c (ep_construct), (ep_finalise): Memory leak fixes.
+	
 2005-08-23  Not Zed  <NotZed Ximian com>
 
 	* e-util.c (e_mkdir_hier): cast warning, good ol win32 patches.
Index: e-util/e-plugin.c
===================================================================
RCS file: /cvs/gnome/evolution/e-util/e-plugin.c,v
retrieving revision 1.18
diff -u -p -r1.18 e-plugin.c
--- e-util/e-plugin.c	22 Aug 2005 19:46:44 -0000	1.18
+++ e-util/e-plugin.c	26 Sep 2005 07:38:07 -0000
@@ -168,6 +168,9 @@ ep_construct(EPlugin *ep, xmlNodePtr roo
 				if (!g_hash_table_lookup_extended(ep_plugins_pending_hooks, class, (void **)&oldclass, (void **)&l)) {
 					oldclass = class;
 					l = NULL;
+				} else {
+					/* Already exist, so free the "new" class */
+					g_free (class);
 				}
 				l = g_slist_prepend(l, ep);
 				g_hash_table_insert(ep_plugins_pending_hooks, oldclass, l);
@@ -207,6 +210,16 @@ ep_enable(EPlugin *ep, int state)
 }
 
 static void
+ep_free_EPA (EPluginAuthor* epa)
+{
+  if (epa) {
+    g_free (epa->name);
+    g_free (epa->email);
+    g_free (epa);    
+  }
+}
+
+static void
 ep_finalise(GObject *o)
 {
 	EPlugin *ep = (EPlugin *)o;
@@ -219,6 +232,11 @@ ep_finalise(GObject *o)
 
 	g_slist_foreach(ep->hooks, (GFunc)g_object_unref, NULL);
 	g_slist_free(ep->hooks);
+
+	if (ep->authors) {
+	  g_slist_foreach(ep->authors, (GFunc)ep_free_EPA, NULL);
+	  g_slist_free (ep->authors);
+	}
 
 	((GObjectClass *)ep_parent_class)->finalize(o);
 }
Index: shell/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/shell/ChangeLog,v
retrieving revision 1.1541
diff -u -p -r1.1541 ChangeLog
--- shell/ChangeLog	23 Sep 2005 09:44:58 -0000	1.1541
+++ shell/ChangeLog	26 Sep 2005 07:38:07 -0000
@@ -1,3 +1,7 @@
+2005-09-26  Veerapuram Varadhan <vvaradhan novell cm>
+
+	* e-shell.c (impl_finalize): Memory leak fix.
+	
 2005-09-23  S.Antony Vincent Pandian <santony gmail com>
 
 	solves bug # 307780
Index: shell/e-shell.c
===================================================================
RCS file: /cvs/gnome/evolution/shell/e-shell.c,v
retrieving revision 1.267
diff -u -p -r1.267 e-shell.c
--- shell/e-shell.c	18 Aug 2005 04:35:31 -0000	1.267
+++ shell/e-shell.c	26 Sep 2005 07:38:07 -0000
@@ -455,9 +455,11 @@ impl_finalize (GObject *object)
 	shell = E_SHELL (object);
 	priv = shell->priv;
 
-	if (priv->iid != NULL)
+	if (priv->iid != NULL) {
 		bonobo_activation_active_server_unregister (priv->iid,
 							    bonobo_object_corba_objref (BONOBO_OBJECT (shell)));
+		g_free (priv->iid);
+	}
 
 	e_free_string_list (priv->crash_type_names);
 


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