[PATCH 2/3] lib: Release resources if notmuch_database_open fails
authorAustin Clements <amdragon@MIT.EDU>
Sun, 29 Jan 2012 05:50:09 +0000 (00:50 +1900)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:43:29 +0000 (09:43 -0800)
08/8a7cd44ba4d7238da67433e6b9257defe360f9 [new file with mode: 0644]

diff --git a/08/8a7cd44ba4d7238da67433e6b9257defe360f9 b/08/8a7cd44ba4d7238da67433e6b9257defe360f9
new file mode 100644 (file)
index 0000000..ebf5cff
--- /dev/null
@@ -0,0 +1,93 @@
+Return-Path: <amthrax@drake.mit.edu>\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 5D724431FB6\r
+       for <notmuch@notmuchmail.org>; Sat, 28 Jan 2012 21:50:16 -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 Cn77syXHN9CB for <notmuch@notmuchmail.org>;\r
+       Sat, 28 Jan 2012 21:50:15 -0800 (PST)\r
+Received: from dmz-mailsec-scanner-1.mit.edu (DMZ-MAILSEC-SCANNER-1.MIT.EDU\r
+       [18.9.25.12])\r
+       by olra.theworths.org (Postfix) with ESMTP id 805E2431FAE\r
+       for <notmuch@notmuchmail.org>; Sat, 28 Jan 2012 21:50:15 -0800 (PST)\r
+X-AuditID: 1209190c-b7fad6d000000920-d5-4f24de166a3a\r
+Received: from mailhub-auth-2.mit.edu ( [18.7.62.36])\r
+       by dmz-mailsec-scanner-1.mit.edu (Symantec Messaging Gateway) with SMTP\r
+       id F3.FF.02336.61ED42F4; Sun, 29 Jan 2012 00:50:15 -0500 (EST)\r
+Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103])\r
+       by mailhub-auth-2.mit.edu (8.13.8/8.9.2) with ESMTP id q0T5oE9P029407; \r
+       Sun, 29 Jan 2012 00:50:14 -0500\r
+Received: from drake.mit.edu\r
+       (209-6-116-242.c3-0.arl-ubr1.sbo-arl.ma.cable.rcn.com\r
+       [209.6.116.242]) (authenticated bits=0)\r
+       (User authenticated as amdragon@ATHENA.MIT.EDU)\r
+       by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id q0T5oCHn028024\r
+       (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);\r
+       Sun, 29 Jan 2012 00:50:13 -0500 (EST)\r
+Received: from amthrax by drake.mit.edu with local (Exim 4.77)\r
+       (envelope-from <amthrax@drake.mit.edu>)\r
+       id 1RrNeW-0007ad-5U; Sun, 29 Jan 2012 00:50:12 -0500\r
+From: Austin Clements <amdragon@MIT.EDU>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH 2/3] lib: Release resources if notmuch_database_open fails\r
+Date: Sun, 29 Jan 2012 00:50:09 -0500\r
+Message-Id: <1327816210-29124-2-git-send-email-amdragon@mit.edu>\r
+X-Mailer: git-send-email 1.7.7.3\r
+In-Reply-To: <1327816210-29124-1-git-send-email-amdragon@mit.edu>\r
+References: <1327816210-29124-1-git-send-email-amdragon@mit.edu>\r
+X-Brightmail-Tracker:\r
+ H4sIAAAAAAAAA+NgFtrEIsWRmVeSWpSXmKPExsUixG6noit+T8XfYPoNJovrN2cyOzB6PFt1\r
+       izmAMYrLJiU1J7MstUjfLoEro33GcZaC/ywV216cZW5gbGXpYuTkkBAwkfj87S+ULSZx4d56\r
+       ti5GLg4hgX2MEuu3drGCJIQENjBKNP8sh0jcZ5Lonj6NGcKZzyjRcm8LO0gVm4CGxLb9yxlB\r
+       bBEBaYmdd2cDdXNwMAuoSfzpUgEJCwt4Scw/DlHOIqAq0fntMVg5r4CDRMuzFjaIKxQkzq0+\r
+       B1bDKeAo8WfVChaIIxwkGhqnM09g5F/AyLCKUTYlt0o3NzEzpzg1Wbc4OTEvL7VI11AvN7NE\r
+       LzWldBMjKGg4JXl2ML45qHSIUYCDUYmHV2GFir8Qa2JZcWXuIUZJDiYlUd4Fd4BCfEn5KZUZ\r
+       icUZ8UWlOanFhxglOJiVRHgdZwLleFMSK6tSi/JhUtIcLErivCpa7/yEBNITS1KzU1MLUotg\r
+       sjIcHEoSvLPuAjUKFqWmp1akZeaUIKSZODhBhvMADfcAqeEtLkjMLc5Mh8ifYlSUEuedCZIQ\r
+       AElklObB9cKi+hWjONArwrzdIFU8wIQA1/0KaDAT0OCIq4ogg0sSEVJSDYxTb0/O1Nsm2WIx\r
+       I6/vifQscbtCuU81RQmviqZcijwlYCQ/4X71WgYJc+2v59ZLTjpq+a9jGq/9C8d1c+fHTePZ\r
+       qvf87JN5dye5rakVSI4q9wn0+Oz28MHNrCqjjXk74yq0l/05pC+f011b9X/jv8lWeSuW3uMx\r
+       WzSZXzD2pcFsdp/1ilyWdbOVWIozEg21mIuKEwGo8M8jxQIAAA==\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: Sun, 29 Jan 2012 05:50:16 -0000\r
+\r
+Previously, if a Xapian exception occurred in notmuch_database_open,\r
+we failed to clean up the allocated notmuch_database_t object.\r
+---\r
+ lib/database.cc |    1 +\r
+ 1 files changed, 1 insertions(+), 0 deletions(-)\r
+\r
+diff --git a/lib/database.cc b/lib/database.cc\r
+index a6d15a1..94022d7 100644\r
+--- a/lib/database.cc\r
++++ b/lib/database.cc\r
+@@ -703,6 +703,7 @@ notmuch_database_open (const char *path,\r
+     } catch (const Xapian::Error &error) {\r
+       fprintf (stderr, "A Xapian exception occurred opening database: %s\n",\r
+                error.get_msg().c_str());\r
++      notmuch_database_close (notmuch);\r
+       notmuch = NULL;\r
+     }\r
+ \r
+-- \r
+1.7.7.3\r
+\r