Re: [PATCH] lib/message-file: plug three memleaks.
authorAustin Clements <amdragon@mit.edu>
Mon, 9 May 2011 12:42:14 +0000 (08:42 +2000)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:38:11 +0000 (09:38 -0800)
a0/f34ad3f9ae650db98c22251e876221426e050c [new file with mode: 0644]

diff --git a/a0/f34ad3f9ae650db98c22251e876221426e050c b/a0/f34ad3f9ae650db98c22251e876221426e050c
new file mode 100644 (file)
index 0000000..4680e70
--- /dev/null
@@ -0,0 +1,130 @@
+Return-Path: <amdragon@gmail.com>\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 1720C429E20\r
+       for <notmuch@notmuchmail.org>; Mon,  9 May 2011 05:42:18 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.699\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.699 tagged_above=-999 required=5\r
+       tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, FREEMAIL_FROM=0.001,\r
+       RCVD_IN_DNSWL_LOW=-0.7] 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 i318BnKJWidb for <notmuch@notmuchmail.org>;\r
+       Mon,  9 May 2011 05:42:15 -0700 (PDT)\r
+Received: from mail-qw0-f53.google.com (mail-qw0-f53.google.com\r
+       [209.85.216.53]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id 44F76431FB5\r
+       for <notmuch@notmuchmail.org>; Mon,  9 May 2011 05:42:15 -0700 (PDT)\r
+Received: by qwb7 with SMTP id 7so3511587qwb.26\r
+       for <notmuch@notmuchmail.org>; Mon, 09 May 2011 05:42:14 -0700 (PDT)\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;\r
+       h=domainkey-signature:mime-version:sender:in-reply-to:references:date\r
+       :x-google-sender-auth:message-id:subject:from:to:cc:content-type\r
+       :content-transfer-encoding;\r
+       bh=vSsEZ6oRhD2lmBkkRWSiSAIzwjQH5JKkfXwIN71an+U=;\r
+       b=te65HGGuyXiTEEhe28nb9v+5AechgQwSXX5sUagLLJ8za1SeFs+TtoUhsCfJCGzQ5P\r
+       gaPnyjQhLCR4F7eEtsMxLWdRFz+o2psQPMl17h64fQ/zXz0idAI9IfVFhh/kcvyNtwRy\r
+       zQuQO9c+IwDkdgJT4b55qAmNxMtRu0C1mk7Y8=\r
+DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma;\r
+       h=mime-version:sender:in-reply-to:references:date\r
+       :x-google-sender-auth:message-id:subject:from:to:cc:content-type\r
+       :content-transfer-encoding;\r
+       b=jUk+Y0gJOygXVHq69E9cu2GTwMxng9SFJrOs/04T+jMfkrpUYxHSecvXBUzCK4O9kj\r
+       3iawPHkaz+BQFRvIoYMWS+vZ+p+xb8X3tEwygx9C0rn0pGXEBaoZkpGOq/Qth9RscRjX\r
+       L0/Sdahrtzv0bSFzPa/WqU6C6OGccD3rlQT2A=\r
+MIME-Version: 1.0\r
+Received: by 10.229.127.144 with SMTP id g16mr5022481qcs.152.1304944934658;\r
+       Mon, 09 May 2011 05:42:14 -0700 (PDT)\r
+Sender: amdragon@gmail.com\r
+Received: by 10.229.233.17 with HTTP; Mon, 9 May 2011 05:42:14 -0700 (PDT)\r
+In-Reply-To: <20110509064645.2B6AD7F508@zohar.localdomain>\r
+References: <1302878638-17634-1-git-send-email-anton@khirnov.net>\r
+       <20110509064645.2B6AD7F508@zohar.localdomain>\r
+Date: Mon, 9 May 2011 08:42:14 -0400\r
+X-Google-Sender-Auth: keltB0nPwr4026734UnS_-AYsN4\r
+Message-ID: <BANLkTikudNN6b53XfeTiSkQzUv1pouexTg@mail.gmail.com>\r
+Subject: Re: [PATCH] lib/message-file: plug three memleaks.\r
+From: Austin Clements <amdragon@mit.edu>\r
+To: Anton Khirnov <anton@khirnov.net>\r
+Content-Type: text/plain; charset=ISO-8859-1\r
+Content-Transfer-Encoding: quoted-printable\r
+Cc: notmuch@notmuchmail.org\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: Mon, 09 May 2011 12:42:18 -0000\r
+\r
+Cool.  This looks like a pretty nasty leak and I'm pretty sure your\r
+patch is correct (though it took me a while to convince myself!).\r
+\r
+My one nit is code style.  There should be a space between the\r
+function name and the paren.  (Oddly, the is_received handling that\r
+you changed is the only place in notmuch where I've seen this style\r
+violated; but there's no sense in spreading this inconsistency.)\r
+\r
+On Mon, May 9, 2011 at 2:46 AM, Anton Khirnov <anton@khirnov.net> wrote:\r
+> On Fri, 15 Apr 2011 16:43:58 +0200, Anton Khirnov <anton@khirnov.net> wro=\r
+te:\r
+>> ---\r
+>> =A0lib/message-file.c | =A0 =A05 +++++\r
+>> =A01 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_f=\r
+ile_t *message,\r
+>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 strncpy(combined_header,header_sofar,hdrsofa=\r
+r);\r
+>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 *(combined_header+hdrsofar) =3D ' ';\r
+>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 strncpy(combined_header+hdrsofar+1,decoded_v=\r
+alue,newhdr+1);\r
+>> + =A0 =A0 =A0 =A0 =A0 =A0 free(decoded_value);\r
+>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 g_hash_table_insert (message->headers, heade=\r
+r, combined_header);\r
+>> =A0 =A0 =A0 =A0 =A0 }\r
+>> =A0 =A0 =A0 } else {\r
+>> =A0 =A0 =A0 =A0 =A0 if (header_sofar =3D=3D NULL) {\r
+>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 /* Only insert if we don't have a value for =\r
+this header, yet. */\r
+>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 g_hash_table_insert (message->headers, heade=\r
+r, decoded_value);\r
+>> + =A0 =A0 =A0 =A0 } else {\r
+>> + =A0 =A0 =A0 =A0 =A0 =A0 free(header);\r
+>> + =A0 =A0 =A0 =A0 =A0 =A0 free(decoded_value);\r
+>> + =A0 =A0 =A0 =A0 =A0 =A0 decoded_value =3D header_sofar;\r
+>> =A0 =A0 =A0 =A0 =A0 }\r
+>> =A0 =A0 =A0 }\r
+>> =A0 =A0 =A0 /* if we found a match we can bail - unless of course we are\r
+>> --\r
+>> 1.7.4.1\r
+>>\r
+>> _______________________________________________\r
+>> notmuch mailing list\r
+>> notmuch@notmuchmail.org\r
+>> http://notmuchmail.org/mailman/listinfo/notmuch\r
+>\r
+> ping\r
+>\r
+> --\r
+> Anton Khirnov\r
+> _______________________________________________\r
+> notmuch mailing list\r
+> notmuch@notmuchmail.org\r
+> http://notmuchmail.org/mailman/listinfo/notmuch\r
+>\r