[PATCH] Release memory allocated by internet_address_list_parse_string()

Tomi Ollila tomi.ollila at iki.fi
Wed Dec 7 12:13:19 PST 2011


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



More information about the notmuch mailing list