From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by arlo.cworth.org (Postfix) with ESMTP id A17FE6DE00D2 for ; Sun, 21 May 2017 06:17:33 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at cworth.org X-Spam-Flag: NO X-Spam-Score: -0.001 X-Spam-Level: X-Spam-Status: No, score=-0.001 tagged_above=-999 required=5 tests=[AWL=0.010, SPF_PASS=-0.001, T_RP_MATCHES_RCVD=-0.01] autolearn=disabled Received: from arlo.cworth.org ([127.0.0.1]) by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id XUKHXVj5Uv0z for ; Sun, 21 May 2017 06:17:32 -0700 (PDT) Received: from fethera.tethera.net (fethera.tethera.net [198.245.60.197]) by arlo.cworth.org (Postfix) with ESMTPS id A7DBD6DE00C6 for ; Sun, 21 May 2017 06:17:32 -0700 (PDT) Received: from remotemail by fethera.tethera.net with local (Exim 4.84_2) (envelope-from ) id 1dCQiq-000414-Vz; Sun, 21 May 2017 09:16:37 -0400 Received: (nullmailer pid 8067 invoked by uid 1000); Sun, 21 May 2017 13:17:30 -0000 From: David Bremner To: notmuch@notmuchmail.org, notmuch@freelists.org Subject: Re: [PATCH 5/5] cli/reply: fix memory leak In-Reply-To: <20170521124821.23924-6-david@tethera.net> References: <20170521124821.23924-1-david@tethera.net> <20170521124821.23924-6-david@tethera.net> Date: Sun, 21 May 2017 10:17:30 -0300 Message-ID: <87r2ziwdqt.fsf@tethera.net> MIME-Version: 1.0 Content-Type: text/plain X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 May 2017 13:17:33 -0000 David Bremner 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.