[PATCH 2/3] Fix memory leak in guess_from_received_header().

Subject: [PATCH 2/3] Fix memory leak in guess_from_received_header().

Date: Wed, 15 Jun 2011 15:12:13 +0400

To: notmuch@notmuchmail.org

Cc:

From: Dmitry Kurochkin


Mta variable was not free()d in one case.
---
 notmuch-reply.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/notmuch-reply.c b/notmuch-reply.c
index dab69e6..64f70bf 100644
--- a/notmuch-reply.c
+++ b/notmuch-reply.c
@@ -401,8 +401,10 @@ guess_from_received_header (notmuch_config_t *config, notmuch_message_t *message
 	    break;
 	mta = xstrdup (by);
 	token = strtok(mta," \t");
-	if (token == NULL)
+	if (token == NULL) {
+	    free (mta);
 	    break;
+	}
 	/* Now extract the last two components of the MTA host name
 	 * as domain and tld.
 	 */
-- 
1.7.5.4


Thread: