unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: David Bremner <david@tethera.net>
To: notmuch@notmuchmail.org, notmuch@freelists.org
Subject: Re: [PATCH 5/5] cli/reply: fix memory leak
Date: Sun, 21 May 2017 10:17:30 -0300	[thread overview]
Message-ID: <87r2ziwdqt.fsf@tethera.net> (raw)
In-Reply-To: <20170521124821.23924-6-david@tethera.net>

David Bremner <david@tethera.net> writes:

> internet_address_list_to_string returns an allocated string, which
> needs to be freed with g_free.
> ---
>  notmuch-reply.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/notmuch-reply.c b/notmuch-reply.c
> index 9239aac2..6cab75bf 100644
> --- a/notmuch-reply.c
> +++ b/notmuch-reply.c
> @@ -45,7 +45,7 @@ format_part_reply (GMimeStream *stream, mime_node_t *node)
>      } else if (GMIME_IS_MESSAGE (node->part)) {
>  	GMimeMessage *message = GMIME_MESSAGE (node->part);
>  	InternetAddressList *recipients;
> -	const char *recipients_string;
> +	char *recipients_string;
>  
>  	g_mime_stream_printf (stream, "> From: %s\n", g_mime_message_get_sender (message));
>  	recipients = g_mime_message_get_recipients (message, GMIME_RECIPIENT_TYPE_TO);
> -- 
> 2.11.0

Oops. Apparently I rebased away the actual fix. It needs added calls to
g_free (recipients_string) like those in notmuch_show.c. There is also a
trickier leak involving internet_address_list_parse_string call
indirectly by add_recipients_from_message.

      reply	other threads:[~2017-05-21 13:17 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-21 12:48 gmime 3.0 related preliminaries David Bremner
2017-05-21 12:48 ` [PATCH 1/5] util: convenience function to create gmime stream for stdout David Bremner
2017-05-21 13:28   ` David Bremner
2017-05-21 15:34     ` David Bremner
2017-05-21 12:48 ` [PATCH 2/5] cli/reply: direct all output for text format to gmime stream David Bremner
2017-05-21 12:48 ` [PATCH 3/5] cli/show: use single stream for printf / gmime object output David Bremner
2017-05-21 12:48 ` [PATCH 4/5] perf-test: add memory test for reply David Bremner
2017-05-21 12:48 ` [PATCH 5/5] cli/reply: fix memory leak David Bremner
2017-05-21 13:17   ` David Bremner [this message]

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=87r2ziwdqt.fsf@tethera.net \
    --to=david@tethera.net \
    --cc=notmuch@freelists.org \
    --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).