unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* [PATCH] Release memory allocated by internet_address_list_parse_string()
@ 2011-12-07 20:13 Tomi Ollila
  2011-12-07 21:29 ` Tomi Ollila
  0 siblings, 1 reply; 7+ messages in thread
From: Tomi Ollila @ 2011-12-07 20:13 UTC (permalink / raw)
  To: notmuch

g_object_unref() releases the memory of the InternetAddressList object
returned by internet_address_list_parse_string() -- when last (only)
reference is released, internet_address_list_finalize() will do cleanup.
---
When reviewing, see also gmime-2.4.25/gmime/internet-address.c (or older)
I tested this patch by entering:  notmuch show --format=mbox '*' | wc

Note that this fixes one potential memory leak only in case --format=mbox
as _extract_email_address is called only there.

 notmuch-show.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/notmuch-show.c b/notmuch-show.c
index 603992a..3abfa07 100644
--- a/notmuch-show.c
+++ b/notmuch-show.c
@@ -255,7 +255,7 @@ _extract_email_address (const void *ctx, const char *from)
     email = talloc_strdup (ctx, email);
 
   DONE:
-    /* XXX: How to free addresses here? */
+    g_object_unref (addresses);
     return email;
    }
 
-- 
1.7.7.3

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2011-12-11 14:49 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-12-07 20:13 [PATCH] Release memory allocated by internet_address_list_parse_string() Tomi Ollila
2011-12-07 21:29 ` Tomi Ollila
2011-12-09 13:52   ` [Patch 1/2] separate handling when addresses == NULL Tomi Ollila
2011-12-09 15:57     ` Austin Clements
2011-12-09 13:53   ` [PATCH 2/2] Release memory allocated by internet_address_list_parse_string() Tomi Ollila
2011-12-10 10:18     ` [PATCH v3] " Tomi Ollila
2011-12-11 14:49       ` David Bremner

Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).