Re: [PATCH 1/2] Add Google Inc. to AUTHORS as a contributor.
[notmuch-archives.git] / b8 / baf88ec6fdec54c4b09c757c8f5f76ca5c385a
1 Return-Path: <anton@khirnov.net>\r
2 X-Original-To: notmuch@notmuchmail.org\r
3 Delivered-To: notmuch@notmuchmail.org\r
4 Received: from localhost (localhost [127.0.0.1])\r
5         by olra.theworths.org (Postfix) with ESMTP id 4A5DB429E20\r
6         for <notmuch@notmuchmail.org>; Mon,  9 May 2011 08:17:27 -0700 (PDT)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: 0\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]\r
12         autolearn=disabled\r
13 Received: from olra.theworths.org ([127.0.0.1])\r
14         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
15         with ESMTP id k4fwTEgSvAlX for <notmuch@notmuchmail.org>;\r
16         Mon,  9 May 2011 08:17:27 -0700 (PDT)\r
17 Received: from smtp1.kolej.mff.cuni.cz (smtp1.kolej.mff.cuni.cz\r
18         [78.128.192.10])\r
19         (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))\r
20         (No client certificate requested)\r
21         by olra.theworths.org (Postfix) with ESMTPS id B1C91431FB5\r
22         for <notmuch@notmuchmail.org>; Mon,  9 May 2011 08:17:26 -0700 (PDT)\r
23 X-Envelope-From: anton@khirnov.net\r
24 Received: from zohar.localdomain (zohar.kolej.mff.cuni.cz [78.128.198.199])\r
25         by smtp1.kolej.mff.cuni.cz (8.14.4/8.14.4) with ESMTP id p49FHNJe090133\r
26         for <notmuch@notmuchmail.org>; Mon, 9 May 2011 17:17:24 +0200 (CEST)\r
27         (envelope-from anton@khirnov.net)\r
28 Received: by zohar.localdomain (Postfix, from userid 1000)\r
29         id 416FA7F508; Mon,  9 May 2011 17:17:23 +0200 (CEST)\r
30 From: Anton Khirnov <anton@khirnov.net>\r
31 To: notmuch@notmuchmail.org\r
32 Subject: [PATCH] lib/message-file: plug three memleaks.\r
33 Date: Mon,  9 May 2011 17:17:08 +0200\r
34 Message-Id: <1304954228-22350-1-git-send-email-anton@khirnov.net>\r
35 X-Mailer: git-send-email 1.7.5.1\r
36 In-Reply-To: <BANLkTikudNN6b53XfeTiSkQzUv1pouexTg@mail.gmail.com>\r
37 References: <BANLkTikudNN6b53XfeTiSkQzUv1pouexTg@mail.gmail.com>\r
38 X-BeenThere: notmuch@notmuchmail.org\r
39 X-Mailman-Version: 2.1.13\r
40 Precedence: list\r
41 List-Id: "Use and development of the notmuch mail system."\r
42         <notmuch.notmuchmail.org>\r
43 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
44         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
45 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
46 List-Post: <mailto:notmuch@notmuchmail.org>\r
47 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
48 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
49         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
50 X-List-Received-Date: Mon, 09 May 2011 15:17:27 -0000\r
51 \r
52 ---\r
53  lib/message-file.c |    5 +++++\r
54  1 files changed, 5 insertions(+), 0 deletions(-)\r
55 \r
56 diff --git a/lib/message-file.c b/lib/message-file.c\r
57 index 7722832..99505c1 100644\r
58 --- a/lib/message-file.c\r
59 +++ b/lib/message-file.c\r
60 @@ -341,12 +341,17 @@ notmuch_message_file_get_header (notmuch_message_file_t *message,\r
61                 strncpy(combined_header,header_sofar,hdrsofar);\r
62                 *(combined_header+hdrsofar) = ' ';\r
63                 strncpy(combined_header+hdrsofar+1,decoded_value,newhdr+1);\r
64 +               free (decoded_value);\r
65                 g_hash_table_insert (message->headers, header, combined_header);\r
66             }\r
67         } else {\r
68             if (header_sofar == NULL) {\r
69                 /* Only insert if we don't have a value for this header, yet. */\r
70                 g_hash_table_insert (message->headers, header, decoded_value);\r
71 +           } else {\r
72 +               free (header);\r
73 +               free (decoded_value);\r
74 +               decoded_value = header_sofar;\r
75             }\r
76         }\r
77         /* if we found a match we can bail - unless of course we are\r
78 -- \r
79 1.7.5.1\r
80 \r