[PATCH 2/2] cli: close config and do talloc report also on errors
[notmuch-archives.git] / ac / 4d60bac1baad99c2055f12e1d0d1fb11002b53
diff --git a/ac/4d60bac1baad99c2055f12e1d0d1fb11002b53 b/ac/4d60bac1baad99c2055f12e1d0d1fb11002b53
new file mode 100644 (file)
index 0000000..fe55010
--- /dev/null
@@ -0,0 +1,106 @@
+Return-Path: <jani@nikula.org>\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 3BE51431FBC\r
+       for <notmuch@notmuchmail.org>; Fri, 10 Jan 2014 13:29:14 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.7\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
+       tests=[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 oUXpyZCJcX2S for <notmuch@notmuchmail.org>;\r
+       Fri, 10 Jan 2014 13:29:07 -0800 (PST)\r
+Received: from mail-ea0-f180.google.com (mail-ea0-f180.google.com\r
+       [209.85.215.180]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id 0A168431FBF\r
+       for <notmuch@notmuchmail.org>; Fri, 10 Jan 2014 13:29:02 -0800 (PST)\r
+Received: by mail-ea0-f180.google.com with SMTP id f15so2286490eak.25\r
+       for <notmuch@notmuchmail.org>; Fri, 10 Jan 2014 13:29:01 -0800 (PST)\r
+X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;\r
+       d=1e100.net; s=20130820;\r
+       h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\r
+       :references;\r
+       bh=WjAA/9NDx0xJ+UtolPvWzN8OgSeQdRXyuj9Sh3UmvQk=;\r
+       b=Yohdfzx3vDRfB3qkzUlDamtQzYdSzQ+UeCZy6Oi4BCFvolN6y1tV/OBC5N+mdqEmQz\r
+       iZTQHeqwh+sPQfUcul2HvIgeK/84IpSJN22Eqhk3mlIv/lG+z21Qt82QX1dNyqZ9XyH/\r
+       yFepD3+QuqhX+zWol1GIpgNFAGYAoXJemyMXpR0xvJnuwiKj/doHUtAANDYTJi9kfG8X\r
+       DlfOGFVb3A0fY5zG0fqRyZt73vc+RYbTrnDwXtyuEVQ6Hshw5oAZzTl1LlkyvNPh1zvP\r
+       dtzUIfgTy0n4bk3kN8iqCT2tQ6HQAxow9SFCNjV895GWS2cSdP+8qXvUfFW4/nue7twj\r
+       TOhg==\r
+X-Gm-Message-State:\r
+ ALoCoQlWbuxUVFTccQqelDMW0SgBsWNhL9gT0rIaDAVWlJXxNmt4hf1m/+1U6qktndAVCx64EcuC\r
+X-Received: by 10.14.208.199 with SMTP id q47mr12100629eeo.77.1389389341880;\r
+       Fri, 10 Jan 2014 13:29:01 -0800 (PST)\r
+Received: from localhost (dsl-hkibrasgw2-58c36f-91.dhcp.inet.fi.\r
+       [88.195.111.91])\r
+       by mx.google.com with ESMTPSA id d2sm2678419eeh.3.2014.01.10.13.29.00\r
+       for <multiple recipients>\r
+       (version=TLSv1.2 cipher=RC4-SHA bits=128/128);\r
+       Fri, 10 Jan 2014 13:29:01 -0800 (PST)\r
+From: Jani Nikula <jani@nikula.org>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH 2/2] cli: close config and do talloc report also on errors\r
+Date: Fri, 10 Jan 2014 23:28:54 +0200\r
+Message-Id: <1389389334-24138-2-git-send-email-jani@nikula.org>\r
+X-Mailer: git-send-email 1.8.5.2\r
+In-Reply-To: <1389389334-24138-1-git-send-email-jani@nikula.org>\r
+References: <1389389334-24138-1-git-send-email-jani@nikula.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: Fri, 10 Jan 2014 21:29:14 -0000\r
+\r
+Seems like the sensible thing to do.\r
+---\r
+ notmuch.c | 7 ++++---\r
+ 1 file changed, 4 insertions(+), 3 deletions(-)\r
+\r
+diff --git a/notmuch.c b/notmuch.c\r
+index 2d7f33d..b3fa9f3 100644\r
+--- a/notmuch.c\r
++++ b/notmuch.c\r
+@@ -256,7 +256,7 @@ main (int argc, char *argv[])\r
+     const char *command_name = NULL;\r
+     command_t *command;\r
+     char *config_file_name = NULL;\r
+-    notmuch_config_t *config;\r
++    notmuch_config_t *config = NULL;\r
+     notmuch_bool_t print_help=FALSE, print_version=FALSE;\r
+     int opt_index;\r
+     int ret;\r
+@@ -316,7 +316,9 @@ main (int argc, char *argv[])\r
\r
+     ret = (command->function)(config, argc - opt_index, argv + opt_index);\r
\r
+-    notmuch_config_close (config);\r
++  DONE:\r
++    if (config)\r
++      notmuch_config_close (config);\r
\r
+     talloc_report = getenv ("NOTMUCH_TALLOC_REPORT");\r
+     if (talloc_report && strcmp (talloc_report, "") != 0) {\r
+@@ -334,7 +336,6 @@ main (int argc, char *argv[])\r
+       }\r
+     }\r
\r
+-  DONE:\r
+     talloc_free (local);\r
\r
+     return ret;\r
+-- \r
+1.8.5.2\r
+\r