[PATCH] lib/message-file: plug three memleaks.
authorAnton Khirnov <anton@khirnov.net>
Fri, 15 Apr 2011 14:43:58 +0000 (16:43 +0200)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:38:04 +0000 (09:38 -0800)
b4/82586a152435a926f860e98b0270fe804c623c [new file with mode: 0644]

diff --git a/b4/82586a152435a926f860e98b0270fe804c623c b/b4/82586a152435a926f860e98b0270fe804c623c
new file mode 100644 (file)
index 0000000..fbb47bf
--- /dev/null
@@ -0,0 +1,80 @@
+Return-Path: <anton@khirnov.net>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id F1407431FB6\r
+       for <notmuch@notmuchmail.org>; Fri, 15 Apr 2011 08:15:44 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]\r
+       autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id 20Gz1Es77-z5 for <notmuch@notmuchmail.org>;\r
+       Fri, 15 Apr 2011 08:15:44 -0700 (PDT)\r
+X-Greylist: delayed 1899 seconds by postgrey-1.32 at olra;\r
+       Fri, 15 Apr 2011 08:15:44 PDT\r
+Received: from smtp1.kolej.mff.cuni.cz (smtp1.kolej.mff.cuni.cz\r
+       [78.128.192.10])\r
+       (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id 30F11431FB5\r
+       for <notmuch@notmuchmail.org>; Fri, 15 Apr 2011 08:15:43 -0700 (PDT)\r
+X-Envelope-From: anton@khirnov.net\r
+Received: from zohar.localdomain (zohar.kolej.mff.cuni.cz [78.128.198.199])\r
+       by smtp1.kolej.mff.cuni.cz (8.14.4/8.14.4) with ESMTP id p3FEi073098097\r
+       for <notmuch@notmuchmail.org>; Fri, 15 Apr 2011 16:44:02 +0200 (CEST)\r
+       (envelope-from anton@khirnov.net)\r
+Received: by zohar.localdomain (Postfix, from userid 1000)\r
+       id 9D6917F7D8; Fri, 15 Apr 2011 16:44:00 +0200 (CEST)\r
+From: Anton Khirnov <anton@khirnov.net>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH] lib/message-file: plug three memleaks.\r
+Date: Fri, 15 Apr 2011 16:43:58 +0200\r
+Message-Id: <1302878638-17634-1-git-send-email-anton@khirnov.net>\r
+X-Mailer: git-send-email 1.7.4.1\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+       <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Fri, 15 Apr 2011 15:15:45 -0000\r
+\r
+---\r
+ lib/message-file.c |    5 +++++\r
+ 1 files changed, 5 insertions(+), 0 deletions(-)\r
+\r
+diff --git a/lib/message-file.c b/lib/message-file.c\r
+index 7722832..b7b3286 100644\r
+--- a/lib/message-file.c\r
++++ b/lib/message-file.c\r
+@@ -341,12 +341,17 @@ notmuch_message_file_get_header (notmuch_message_file_t *message,\r
+               strncpy(combined_header,header_sofar,hdrsofar);\r
+               *(combined_header+hdrsofar) = ' ';\r
+               strncpy(combined_header+hdrsofar+1,decoded_value,newhdr+1);\r
++              free(decoded_value);\r
+               g_hash_table_insert (message->headers, header, combined_header);\r
+           }\r
+       } else {\r
+           if (header_sofar == NULL) {\r
+               /* Only insert if we don't have a value for this header, yet. */\r
+               g_hash_table_insert (message->headers, header, decoded_value);\r
++          } else {\r
++              free(header);\r
++              free(decoded_value);\r
++              decoded_value = header_sofar;\r
+           }\r
+       }\r
+       /* if we found a match we can bail - unless of course we are\r
+-- \r
+1.7.4.1\r
+\r