From 4a9b024bde8b8eac211f7337638f41f280096cd3 Mon Sep 17 00:00:00 2001 From: Jani Nikula Date: Sun, 3 Nov 2013 14:24:43 +0200 Subject: [PATCH] [PATCH v2 03/11] lib: check talloc success in compact --- 08/0cce952f217a3d33349d3547e3d23c14db1b39 | 101 ++++++++++++++++++++++ 1 file changed, 101 insertions(+) create mode 100644 08/0cce952f217a3d33349d3547e3d23c14db1b39 diff --git a/08/0cce952f217a3d33349d3547e3d23c14db1b39 b/08/0cce952f217a3d33349d3547e3d23c14db1b39 new file mode 100644 index 000000000..67f8c43bc --- /dev/null +++ b/08/0cce952f217a3d33349d3547e3d23c14db1b39 @@ -0,0 +1,101 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by olra.theworths.org (Postfix) with ESMTP id 19665429E25 + for ; Sun, 3 Nov 2013 04:25:13 -0800 (PST) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References" +X-Spam-Flag: NO +X-Spam-Score: -0.7 +X-Spam-Level: +X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5 + tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled +Received: from olra.theworths.org ([127.0.0.1]) + by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id NOUvA7U09Bcf for ; + Sun, 3 Nov 2013 04:25:07 -0800 (PST) +Received: from mail-ee0-f47.google.com (mail-ee0-f47.google.com + [74.125.83.47]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client + certificate requested) by olra.theworths.org (Postfix) with ESMTPS id + E1A90431FD2 for ; Sun, 3 Nov 2013 04:25:02 -0800 + (PST) +Received: by mail-ee0-f47.google.com with SMTP id c13so586300eek.34 + for ; Sun, 03 Nov 2013 04:25:01 -0800 (PST) +X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=1e100.net; s=20130820; + h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to + :references:in-reply-to:references; + bh=26rNZKY9wxF06O1EkFrBz3W+YYp7I8PmFRmeihyPWPY=; + b=kLIYDWBeAnTi553/k7lnSLrjLVQhYg1pX0uWB8XvPmFXBfWfBiCufHzFm+Z289Bs5M + Imt8AsyyV57BfeQlcMx/MdvadJ17/53rttKgCvhhZMy2ZHYwe8wbSBRMjbeRUkI3c0wH + eyitvaS3r33LHRsEycUQcZXGCceydivJFjBXHtqhP3+YJTcTjORRsr9ckyvy34va1493 + oGCAn7MyfzayBQXdQrDqQFTcRtoKwUl7GGk4R+rvRnQXms2bvE895Yb81fKlCEYSNsef + Pn/AQazYd7vrPQatcaMy5S3lMbE0iTWOsHf2p7P341Eq5cVRFz0gt+v9NADf9uz4F2bu + 29pQ== +X-Gm-Message-State: + ALoCoQlIhgLXp0DR9nmkQJsh7utoFtODgpaQjkcF7RFLL07YVp7f3WNPRjOR3k/LAuVRKCfGzIwF +X-Received: by 10.15.50.195 with SMTP id l43mr12706005eew.30.1383481501743; + Sun, 03 Nov 2013 04:25:01 -0800 (PST) +Received: from localhost (dsl-hkibrasgw2-58c36f-91.dhcp.inet.fi. + [88.195.111.91]) + by mx.google.com with ESMTPSA id k7sm32793779eeg.13.2013.11.03.04.25.00 + for + (version=TLSv1.2 cipher=RC4-SHA bits=128/128); + Sun, 03 Nov 2013 04:25:01 -0800 (PST) +From: Jani Nikula +To: notmuch@notmuchmail.org +Subject: [PATCH v2 03/11] lib: check talloc success in compact +Date: Sun, 3 Nov 2013 14:24:43 +0200 +Message-Id: + +X-Mailer: git-send-email 1.8.4.rc3 +In-Reply-To: +References: +In-Reply-To: +References: +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.13 +Precedence: list +List-Id: "Use and development of the notmuch mail system." + +List-Unsubscribe: , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: , + +X-List-Received-Date: Sun, 03 Nov 2013 12:25:13 -0000 + +In line with the allocation checks all around. +--- + lib/database.cc | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +diff --git a/lib/database.cc b/lib/database.cc +index 3dfea0f..7a8702e 100644 +--- a/lib/database.cc ++++ b/lib/database.cc +@@ -863,13 +863,17 @@ notmuch_database_compact (const char* path, + const char* backup_path, + notmuch_compact_status_cb_t status_cb) + { +- void *local = talloc_new (NULL); ++ void *local; + char *notmuch_path, *xapian_path, *compact_xapian_path; + char *old_xapian_path = NULL; + notmuch_status_t ret = NOTMUCH_STATUS_SUCCESS; + notmuch_database_t *notmuch = NULL; + struct stat statbuf; + ++ local = talloc_new (NULL); ++ if (! local) ++ return NOTMUCH_STATUS_OUT_OF_MEMORY; ++ + ret = notmuch_database_open(path, NOTMUCH_DATABASE_MODE_READ_WRITE, ¬much); + if (ret) { + goto DONE; +-- +1.8.4.rc3 + -- 2.26.2