From: Tomi Ollila <tomi.ollila@iki.fi>
To: notmuch@notmuchmail.org
Subject: [PATCH 2/2] Release memory allocated by internet_address_list_parse_string()
Date: Fri, 09 Dec 2011 15:53:53 +0200 [thread overview]
Message-ID: <yf6borhx34e.fsf@taco2.nixu.fi> (raw)
In-Reply-To: <yf61usgul2n.fsf@taco2.nixu.fi>
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 | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/notmuch-show.c b/notmuch-show.c
index c27ef6a..db02891 100644
--- a/notmuch-show.c
+++ b/notmuch-show.c
@@ -259,7 +259,8 @@ _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
next prev parent reply other threads:[~2011-12-09 13:53 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
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 ` Tomi Ollila [this message]
2011-12-10 10:18 ` [PATCH v3] Release memory allocated by internet_address_list_parse_string() Tomi Ollila
2011-12-11 14:49 ` David Bremner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://notmuchmail.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=yf6borhx34e.fsf@taco2.nixu.fi \
--to=tomi.ollila@iki.fi \
--cc=notmuch@notmuchmail.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).