[PATCH 5/5] cli/reply: fix memory leak
David Bremner
david at tethera.net
Sun May 21 06:17:30 PDT 2017
David Bremner <david at 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.
More information about the notmuch
mailing list