[PATCH v2 03/11] lib: check talloc success in compact
authorJani Nikula <jani@nikula.org>
Sun, 3 Nov 2013 12:24:43 +0000 (14:24 +0200)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:57:57 +0000 (09:57 -0800)
08/0cce952f217a3d33349d3547e3d23c14db1b39 [new file with mode: 0644]

diff --git a/08/0cce952f217a3d33349d3547e3d23c14db1b39 b/08/0cce952f217a3d33349d3547e3d23c14db1b39
new file mode 100644 (file)
index 0000000..67f8c43
--- /dev/null
@@ -0,0 +1,101 @@
+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 19665429E25\r
+       for <notmuch@notmuchmail.org>; Sun,  3 Nov 2013 04:25:13 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References"\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 NOUvA7U09Bcf for <notmuch@notmuchmail.org>;\r
+       Sun,  3 Nov 2013 04:25:07 -0800 (PST)\r
+Received: from mail-ee0-f47.google.com (mail-ee0-f47.google.com\r
+ [74.125.83.47])       (using TLSv1 with cipher RC4-SHA (128/128 bits))        (No client\r
+ certificate requested)        by olra.theworths.org (Postfix) with ESMTPS id\r
+ E1A90431FD2   for <notmuch@notmuchmail.org>; Sun,  3 Nov 2013 04:25:02 -0800\r
+ (PST)\r
+Received: by mail-ee0-f47.google.com with SMTP id c13so586300eek.34\r
+       for <notmuch@notmuchmail.org>; Sun, 03 Nov 2013 04:25: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:in-reply-to:references;\r
+       bh=26rNZKY9wxF06O1EkFrBz3W+YYp7I8PmFRmeihyPWPY=;\r
+       b=kLIYDWBeAnTi553/k7lnSLrjLVQhYg1pX0uWB8XvPmFXBfWfBiCufHzFm+Z289Bs5M\r
+       Imt8AsyyV57BfeQlcMx/MdvadJ17/53rttKgCvhhZMy2ZHYwe8wbSBRMjbeRUkI3c0wH\r
+       eyitvaS3r33LHRsEycUQcZXGCceydivJFjBXHtqhP3+YJTcTjORRsr9ckyvy34va1493\r
+       oGCAn7MyfzayBQXdQrDqQFTcRtoKwUl7GGk4R+rvRnQXms2bvE895Yb81fKlCEYSNsef\r
+       Pn/AQazYd7vrPQatcaMy5S3lMbE0iTWOsHf2p7P341Eq5cVRFz0gt+v9NADf9uz4F2bu\r
+       29pQ==\r
+X-Gm-Message-State:\r
+ ALoCoQlIhgLXp0DR9nmkQJsh7utoFtODgpaQjkcF7RFLL07YVp7f3WNPRjOR3k/LAuVRKCfGzIwF\r
+X-Received: by 10.15.50.195 with SMTP id l43mr12706005eew.30.1383481501743;\r
+       Sun, 03 Nov 2013 04:25: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 k7sm32793779eeg.13.2013.11.03.04.25.00\r
+       for <multiple recipients>\r
+       (version=TLSv1.2 cipher=RC4-SHA bits=128/128);\r
+       Sun, 03 Nov 2013 04:25:01 -0800 (PST)\r
+From: Jani Nikula <jani@nikula.org>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH v2 03/11] lib: check talloc success in compact\r
+Date: Sun,  3 Nov 2013 14:24:43 +0200\r
+Message-Id:\r
+ <ec27cd37b66a5a171bf5ad5897ab729e9b8e09c0.1383481295.git.jani@nikula.org>\r
+X-Mailer: git-send-email 1.8.4.rc3\r
+In-Reply-To: <cover.1383481295.git.jani@nikula.org>\r
+References: <cover.1383481295.git.jani@nikula.org>\r
+In-Reply-To: <cover.1383481295.git.jani@nikula.org>\r
+References: <cover.1383481295.git.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: Sun, 03 Nov 2013 12:25:13 -0000\r
+\r
+In line with the allocation checks all around.\r
+---\r
+ lib/database.cc | 6 +++++-\r
+ 1 file changed, 5 insertions(+), 1 deletion(-)\r
+\r
+diff --git a/lib/database.cc b/lib/database.cc\r
+index 3dfea0f..7a8702e 100644\r
+--- a/lib/database.cc\r
++++ b/lib/database.cc\r
+@@ -863,13 +863,17 @@ notmuch_database_compact (const char* path,\r
+                         const char* backup_path,\r
+                         notmuch_compact_status_cb_t status_cb)\r
+ {\r
+-    void *local = talloc_new (NULL);\r
++    void *local;\r
+     char *notmuch_path, *xapian_path, *compact_xapian_path;\r
+     char *old_xapian_path = NULL;\r
+     notmuch_status_t ret = NOTMUCH_STATUS_SUCCESS;\r
+     notmuch_database_t *notmuch = NULL;\r
+     struct stat statbuf;\r
\r
++    local = talloc_new (NULL);\r
++    if (! local)\r
++      return NOTMUCH_STATUS_OUT_OF_MEMORY;\r
++\r
+     ret = notmuch_database_open(path, NOTMUCH_DATABASE_MODE_READ_WRITE, &notmuch);\r
+     if (ret) {\r
+       goto DONE;\r
+-- \r
+1.8.4.rc3\r
+\r