[PATCH 2/3] Fix memory leak in guess_from_received_header().
authorDmitry Kurochkin <dmitry.kurochkin@gmail.com>
Wed, 15 Jun 2011 11:12:13 +0000 (15:12 +0400)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:38:36 +0000 (09:38 -0800)
90/4662e9426c789195b46ddccba54ba659326c6f [new file with mode: 0644]

diff --git a/90/4662e9426c789195b46ddccba54ba659326c6f b/90/4662e9426c789195b46ddccba54ba659326c6f
new file mode 100644 (file)
index 0000000..b391cee
--- /dev/null
@@ -0,0 +1,88 @@
+Return-Path: <dmitry.kurochkin@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 17878429E30\r
+       for <notmuch@notmuchmail.org>; Wed, 15 Jun 2011 04:12:01 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.799\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.799 tagged_above=-999 required=5\r
+       tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
+       FREEMAIL_FROM=0.001, 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 Bx5ufUuB0g7x for <notmuch@notmuchmail.org>;\r
+       Wed, 15 Jun 2011 04:11:59 -0700 (PDT)\r
+Received: from mail-fx0-f53.google.com (mail-fx0-f53.google.com\r
+       [209.85.161.53]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id EC5B8429E2C\r
+       for <notmuch@notmuchmail.org>; Wed, 15 Jun 2011 04:11:56 -0700 (PDT)\r
+Received: by mail-fx0-f53.google.com with SMTP id 8so337389fxm.26\r
+       for <notmuch@notmuchmail.org>; Wed, 15 Jun 2011 04:11:56 -0700 (PDT)\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;\r
+       h=domainkey-signature:from:to:cc:subject:date:message-id:x-mailer\r
+       :in-reply-to:references;\r
+       bh=PAuLW78XBk3bbf/o5yZ2bjSkHsgYekhy4VfBC7BYaew=;\r
+       b=MKMEpVUjD8AZChPBwBrvy+sJHC1vDVmj59/qoh30V7thNyCKUacIDZQvxrJRA0HkGw\r
+       3WRcsqQ1sSZ2bbUviabB2w7G/kVi8sViYCn2XnyYZea6KyGfTUXoxG/LcHElaVS4S8qH\r
+       qmce3kYY3M/fUcspFoyZQAo1Li89+9H0MQo5g=\r
+DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma;\r
+       h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references;\r
+       b=VW0SzORig0VLd2sn7eiO3ucELY/FVOZcqWXKCr4sK37p/2IAqDNKIBk2emHH6qyi0U\r
+       MMz3NcGLyoIl2dtQElTElkT3ObLY62XT+6DSMiCDKL5Z92VfAwC5ArCqWB9l9ULkTjSO\r
+       7HP2ck8BfWNBdM97j02H8eDAKN4aF3FihY33k=\r
+Received: by 10.223.127.210 with SMTP id h18mr445302fas.46.1308136316547;\r
+       Wed, 15 Jun 2011 04:11:56 -0700 (PDT)\r
+Received: from localhost ([91.144.186.21])\r
+       by mx.google.com with ESMTPS id n15sm160960fag.18.2011.06.15.04.11.55\r
+       (version=TLSv1/SSLv3 cipher=OTHER);\r
+       Wed, 15 Jun 2011 04:11:55 -0700 (PDT)\r
+From: Dmitry Kurochkin <dmitry.kurochkin@gmail.com>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH 2/3] Fix memory leak in guess_from_received_header().\r
+Date: Wed, 15 Jun 2011 15:12:13 +0400\r
+Message-Id: <1308136334-9219-2-git-send-email-dmitry.kurochkin@gmail.com>\r
+X-Mailer: git-send-email 1.7.5.4\r
+In-Reply-To: <1308136334-9219-1-git-send-email-dmitry.kurochkin@gmail.com>\r
+References: <1308136334-9219-1-git-send-email-dmitry.kurochkin@gmail.com>\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: Wed, 15 Jun 2011 11:12:01 -0000\r
+\r
+Mta variable was not free()d in one case.\r
+---\r
+ notmuch-reply.c |    4 +++-\r
+ 1 files changed, 3 insertions(+), 1 deletions(-)\r
+\r
+diff --git a/notmuch-reply.c b/notmuch-reply.c\r
+index dab69e6..64f70bf 100644\r
+--- a/notmuch-reply.c\r
++++ b/notmuch-reply.c\r
+@@ -401,8 +401,10 @@ guess_from_received_header (notmuch_config_t *config, notmuch_message_t *message\r
+           break;\r
+       mta = xstrdup (by);\r
+       token = strtok(mta," \t");\r
+-      if (token == NULL)\r
++      if (token == NULL) {\r
++          free (mta);\r
+           break;\r
++      }\r
+       /* Now extract the last two components of the MTA host name\r
+        * as domain and tld.\r
+        */\r
+-- \r
+1.7.5.4\r
+\r