Re: [evolution-patches] [evolution-data-server] Memory leaks



e-name-selector-dialog.c changes are fine.

Thanks,
Sushma.

On Mon, 2006-03-27 at 08:23 -0500, Chris Heath wrote:
> Here is a patch for memory leaks I found in evolution-data-server.
> Please review and apply.
> 
> 
> Index: camel/ChangeLog
> ===================================================================
> RCS file: /cvs/gnome/evolution-data-server/camel/ChangeLog,v
> retrieving revision 1.2529
> diff -u -p -r1.2529 ChangeLog
> --- camel/ChangeLog	20 Mar 2006 16:36:41 -0000	1.2529
> +++ camel/ChangeLog	27 Mar 2006 12:51:09 -0000
> @@ -1,3 +1,9 @@
> +2006-03-26  Chris Heath  <chris heathens co nz>
> +
> +	* camel-net-utils.c (camel_getnameinfo): Fix memory leak
> +	* camel-folder-search.c (camel_folder_search_search): Ditto
> +	* camel-digest-folder.c (digest_add_multipart): Ditto
> +
>  2006-03-20  Parthasarathi Susarla <sparthasarathi novell com>
>  	
>  	** See bug 272307
> Index: camel/camel-digest-folder.c
> ===================================================================
> RCS file: /cvs/gnome/evolution-data-server/camel/camel-digest-folder.c,v
> retrieving revision 1.20
> diff -u -p -r1.20 camel-digest-folder.c
> --- camel/camel-digest-folder.c	31 Aug 2005 04:21:56 -0000	1.20
> +++ camel/camel-digest-folder.c	27 Mar 2006 12:51:09 -0000
> @@ -196,6 +196,7 @@ digest_add_multipart (CamelFolder *folde
>  		}
>  		
>  		info = camel_folder_summary_info_new_from_message (folder->summary, CAMEL_MIME_MESSAGE (wrapper));
> +		g_free(info->uid);
>  		info->uid = g_strdup_printf ("%s%d", preuid, i);
>  		camel_folder_summary_add (folder->summary, info);
>  	}
> Index: camel/camel-folder-search.c
> ===================================================================
> RCS file: /cvs/gnome/evolution-data-server/camel/camel-folder-search.c,v
> retrieving revision 1.76
> diff -u -p -r1.76 camel-folder-search.c
> --- camel/camel-folder-search.c	25 Jan 2006 08:28:32 -0000	1.76
> +++ camel/camel-folder-search.c	27 Mar 2006 12:51:10 -0000
> @@ -463,6 +463,7 @@ camel_folder_search_search(CamelFolderSe
>  		for (i=0;i<search->summary->len;i++)
>  			if (g_hash_table_lookup(uids_hash, camel_message_info_uid(search->summary->pdata[i])))
>  				g_ptr_array_add(search->summary_set, search->summary->pdata[i]);
> +		g_hash_table_destroy(uids_hash);
>  	} else {
>  		summary_set = search->summary;
>  	}
> Index: camel/camel-net-utils.c
> ===================================================================
> RCS file: /cvs/gnome/evolution-data-server/camel/camel-net-utils.c,v
> retrieving revision 1.5
> diff -u -p -r1.5 camel-net-utils.c
> --- camel/camel-net-utils.c	2 Feb 2006 02:44:29 -0000	1.5
> +++ camel/camel-net-utils.c	27 Mar 2006 12:51:10 -0000
> @@ -816,11 +816,12 @@ camel_getnameinfo(const struct sockaddr 
>  	if ((result = msg->result) != 0)
>  		camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, _("Name lookup failed: %s"),
>  				      gai_strerror (result));
> -
> -	if (host)
> -		*host = g_strdup(msg->host);
> -	if (serv)
> -		*serv = g_strdup(msg->serv);
> +	else {
> +		if (host)
> +			*host = g_strdup(msg->host);
> +		if (serv)
> +			*serv = g_strdup(msg->serv);
> +	}
>  
>  	g_free(msg->host);
>  	g_free(msg->serv);
> Index: camel/providers/groupwise/ChangeLog
> ===================================================================
> RCS file: /cvs/gnome/evolution-data-server/camel/providers/groupwise/ChangeLog,v
> retrieving revision 1.149
> diff -u -p -r1.149 ChangeLog
> --- camel/providers/groupwise/ChangeLog	25 Mar 2006 03:44:10 -0000	1.149
> +++ camel/providers/groupwise/ChangeLog	27 Mar 2006 12:51:11 -0000
> @@ -1,3 +1,7 @@
> +2006-03-26  Chris Heath  <chris heathens co nz>
> +
> +	* camel-groupwise-journal.c (update_cache): Fix memory leak
> +
>  2006-03-24  Parthasarathi Susarla <sparthasarathi novell com>
>  	
>  	* camel-groupwise-folder.c: (groupwise_item_folder_to_msg):
> Index: camel/providers/groupwise/camel-groupwise-journal.c
> ===================================================================
> RCS file: /cvs/gnome/evolution-data-server/camel/providers/groupwise/camel-groupwise-journal.c,v
> retrieving revision 1.3
> diff -u -p -r1.3 camel-groupwise-journal.c
> --- camel/providers/groupwise/camel-groupwise-journal.c	31 Aug 2005 04:26:07 -0000	1.3
> +++ camel/providers/groupwise/camel-groupwise-journal.c	27 Mar 2006 12:51:11 -0000
> @@ -372,6 +372,7 @@ update_cache (CamelGroupwiseJournal *gro
>  	camel_object_unref (cache);
>  	
>  	info = camel_folder_summary_info_new_from_message (folder->summary, message);
> +	g_free(info->uid);
>  	info->uid = g_strdup (uid);
>  	
>  	gw_message_info_dup_to ((CamelMessageInfoBase *) info, (CamelMessageInfoBase *) mi);
> Index: camel/providers/imap4/ChangeLog
> ===================================================================
> RCS file: /cvs/gnome/evolution-data-server/camel/providers/imap4/ChangeLog,v
> retrieving revision 1.23
> diff -u -p -r1.23 ChangeLog
> --- camel/providers/imap4/ChangeLog	8 Dec 2005 11:09:12 -0000	1.23
> +++ camel/providers/imap4/ChangeLog	27 Mar 2006 12:51:11 -0000
> @@ -1,3 +1,7 @@
> +2006-03-26  Chris Heath  <chris heathens co nz>
> +
> +	* camel-imap4-journal.c (camel_imap4_journal_append): Fix memory leak
> +
>  2005-12-08  Tor Lillqvist  <tml novell com>
>  
>  	* camel-imap4-store.c: Bypass the external command stuff on Win32.
> Index: camel/providers/imap4/camel-imap4-journal.c
> ===================================================================
> RCS file: /cvs/gnome/evolution-data-server/camel/providers/imap4/camel-imap4-journal.c,v
> retrieving revision 1.5
> diff -u -p -r1.5 camel-imap4-journal.c
> --- camel/providers/imap4/camel-imap4-journal.c	31 Aug 2005 04:26:05 -0000	1.5
> +++ camel/providers/imap4/camel-imap4-journal.c	27 Mar 2006 12:51:11 -0000
> @@ -351,6 +351,7 @@ camel_imap4_journal_append (CamelIMAP4Jo
>  	e_dlist_addtail (&journal->queue, (EDListNode *) entry);
>  	
>  	info = camel_folder_summary_info_new_from_message (folder->summary, message);
> +	g_free(info->uid);
>  	info->uid = g_strdup (uid);
>  	
>  	imap4_message_info_dup_to ((CamelMessageInfoBase *) info, (CamelMessageInfoBase *) mi);
> Index: camel/providers/local/ChangeLog
> ===================================================================
> RCS file: /cvs/gnome/evolution-data-server/camel/providers/local/ChangeLog,v
> retrieving revision 1.17
> diff -u -p -r1.17 ChangeLog
> --- camel/providers/local/ChangeLog	9 Dec 2005 07:57:08 -0000	1.17
> +++ camel/providers/local/ChangeLog	27 Mar 2006 12:51:11 -0000
> @@ -1,3 +1,8 @@
> +2006-03-26  Chris Heath  <chris heathens co nz>
> +
> +	* camel-local-summary.c (message_info_new_from_header): Fix memory leak
> +	* camel-mbox-summary.c (message_info_new_from_header): Ditto
> +
>  2005-12-09  Tor Lillqvist  <tml novell com>
>  
>  	* camel-mbox-folder.c: Just #define O_BINARY as 0 on Unix, less
> Index: camel/providers/local/camel-local-summary.c
> ===================================================================
> RCS file: /cvs/gnome/evolution-data-server/camel/providers/local/camel-local-summary.c,v
> retrieving revision 1.33
> diff -u -p -r1.33 camel-local-summary.c
> --- camel/providers/local/camel-local-summary.c	8 Dec 2005 11:28:47 -0000	1.33
> +++ camel/providers/local/camel-local-summary.c	27 Mar 2006 12:51:11 -0000
> @@ -633,6 +633,7 @@ message_info_new_from_header(CamelFolder
>  		if (xev==NULL || camel_local_summary_decode_x_evolution(cls, xev, mi) == -1) {
>  			/* to indicate it has no xev header */
>  			mi->info.flags |= CAMEL_MESSAGE_FOLDER_FLAGGED | CAMEL_MESSAGE_FOLDER_NOXEV;
> +			g_free (mi->info.uid);
>  			mi->info.uid = camel_folder_summary_next_uid_string(s);
>  
>  			/* shortcut, no need to look it up in the index library */
> Index: camel/providers/local/camel-mbox-summary.c
> ===================================================================
> RCS file: /cvs/gnome/evolution-data-server/camel/providers/local/camel-mbox-summary.c,v
> retrieving revision 1.56
> diff -u -p -r1.56 camel-mbox-summary.c
> --- camel/providers/local/camel-mbox-summary.c	8 Dec 2005 11:28:47 -0000	1.56
> +++ camel/providers/local/camel-mbox-summary.c	27 Mar 2006 12:51:12 -0000
> @@ -318,6 +318,7 @@ message_info_new_from_header(CamelFolder
>  
>  		if (add&1) {
>  			mi->info.info.flags |= CAMEL_MESSAGE_FOLDER_FLAGGED | CAMEL_MESSAGE_FOLDER_NOXEV;
> +			g_free (mi->info.info.uid);
>  			mi->info.info.uid = camel_folder_summary_next_uid_string(s);
>  		} else {
>  			camel_folder_summary_set_uid(s, strtoul(camel_message_info_uid(mi), NULL, 10));
> Index: camel/providers/nntp/ChangeLog
> ===================================================================
> RCS file: /cvs/gnome/evolution-data-server/camel/providers/nntp/ChangeLog,v
> retrieving revision 1.13
> diff -u -p -r1.13 ChangeLog
> --- camel/providers/nntp/ChangeLog	13 Dec 2005 14:03:56 -0000	1.13
> +++ camel/providers/nntp/ChangeLog	27 Mar 2006 12:51:12 -0000
> @@ -1,3 +1,7 @@
> +2006-03-26  Chris Heath  <chris heathens co nz>
> +
> +	* camel-nntp-summary.c (message_info_new_from_header): Fix memory leak
> +
>  2005-12-13  Tor Lillqvist  <tml novell com>
>  
>  	* camel-nntp-grouplist.c
> Index: camel/providers/nntp/camel-nntp-summary.c
> ===================================================================
> RCS file: /cvs/gnome/evolution-data-server/camel/providers/nntp/camel-nntp-summary.c,v
> retrieving revision 1.21
> diff -u -p -r1.21 camel-nntp-summary.c
> --- camel/providers/nntp/camel-nntp-summary.c	31 Aug 2005 04:26:03 -0000	1.21
> +++ camel/providers/nntp/camel-nntp-summary.c	27 Mar 2006 12:51:13 -0000
> @@ -150,7 +150,8 @@ message_info_new_from_header(CamelFolder
>  
>  	mi = (CamelMessageInfoBase *)((CamelFolderSummaryClass *)camel_nntp_summary_parent)->message_info_new_from_header(s, h);
>  	if (mi) {
> -		mi->uid = g_strdup(cns->priv->uid);
> +		g_free(mi->uid);
> +		mi->uid = cns->priv->uid;
>  		cns->priv->uid = NULL;
>  	}
>  	
> Index: camel/providers/pop3/ChangeLog
> ===================================================================
> RCS file: /cvs/gnome/evolution-data-server/camel/providers/pop3/ChangeLog,v
> retrieving revision 1.6
> diff -u -p -r1.6 ChangeLog
> --- camel/providers/pop3/ChangeLog	15 Sep 2005 22:28:37 -0000	1.6
> +++ camel/providers/pop3/ChangeLog	27 Mar 2006 12:51:13 -0000
> @@ -1,3 +1,7 @@
> +2006-03-26  Chris Heath  <chris heathens co nz>
> +
> +	* camel-pop3-engine.c (camel_pop3_engine_finalise): Fix memory leak
> +
>  2005-09-16  Tor Lillqvist  <tml novell com>
>  
>  	* camel-pop3-folder.c: Use g_ascii_strcasecmp() instead of
> Index: camel/providers/pop3/camel-pop3-engine.c
> ===================================================================
> RCS file: /cvs/gnome/evolution-data-server/camel/providers/pop3/camel-pop3-engine.c,v
> retrieving revision 1.11
> diff -u -p -r1.11 camel-pop3-engine.c
> --- camel/providers/pop3/camel-pop3-engine.c	31 Aug 2005 04:26:04 -0000	1.11
> +++ camel/providers/pop3/camel-pop3-engine.c	27 Mar 2006 12:51:13 -0000
> @@ -74,6 +74,10 @@ camel_pop3_engine_finalise(CamelPOP3Engi
>  
>  	if (pe->stream)
>  		camel_object_unref(pe->stream);
> +	
> +	g_list_free(pe->auth);
> +	if (pe->apop)
> +		g_free(pe->apop);
>  }
>  
>  CamelType
> Index: libedataserverui/e-name-selector-dialog.c
> ===================================================================
> RCS file: /cvs/gnome/evolution-data-server/libedataserverui/e-name-selector-dialog.c,v
> retrieving revision 1.29
> diff -u -p -r1.29 e-name-selector-dialog.c
> --- libedataserverui/e-name-selector-dialog.c	2 Mar 2006 16:09:31 -0000	1.29
> +++ libedataserverui/e-name-selector-dialog.c	27 Mar 2006 12:51:15 -0000
> @@ -759,10 +759,9 @@ search_changed (ENameSelectorDialog *nam
>  	category_option_menu = glade_xml_get_widget(name_selector_dialog->gui, "optionmenu-category");
>  	category_id = gtk_option_menu_get_history (GTK_OPTION_MENU(category_option_menu));
>  	category = g_list_nth_data (category_list, category_id);
> -	category_escaped = escape_sexp_string (category);
> -
>  	if (!category)
>  		return;
> +	category_escaped = escape_sexp_string (category);
>  
>  	text = gtk_entry_get_text (name_selector_dialog->search_entry);
>  	text_escaped = escape_sexp_string (text);
> 
> 
> _______________________________________________
> Evolution-patches mailing list
> Evolution-patches gnome org
> http://mail.gnome.org/mailman/listinfo/evolution-patches



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