From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 1CD72429E3C for ; Sun, 3 Nov 2013 04:25:19 -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 ZOzV-DC19HHu for ; Sun, 3 Nov 2013 04:25:13 -0800 (PST) Received: from mail-ee0-f42.google.com (mail-ee0-f42.google.com [74.125.83.42]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id 75BC1431FDA for ; Sun, 3 Nov 2013 04:25:05 -0800 (PST) Received: by mail-ee0-f42.google.com with SMTP id c1so184358eek.1 for ; Sun, 03 Nov 2013 04:25:04 -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=Q18zapYhmVYbh+wYHUDDutg6DE8zQhpUDFrY2a3Qmas=; b=iEz6jU7Nn/OeaUBkLuU/Iub0cig8ysC33rdrDdiHYEQQZxwcVSG8wTB2dBxsU4ZfCB z6v7WUsWxCCofAFLa7achwP1nD7vAKxG3L1/vJSR2vuTiDfR+9Lk7WTR+Dv3vPmDm/X0 nHnJjnWW6lvBUdxPUZeJ4QBhw5/+34rF3PzAVfiWcdOjRBJQGAHoJE/yItCyhpxGAqFT gZ5vRG+OEiBB7bIaiv9iw6xIu+81kbgHNExzQnqYwT8e42gz5XDflI2O73Wl6h9UpFfe G9g4bwGu9blbwPp2ScI6Sd7VmesrrXPFA8vJadNjSEqbOZF1RbMR5lsKJYTO1Bfw61Qo dECw== X-Gm-Message-State: ALoCoQnsDSJJyXABn9et6tceEm+D/4i0Nd11Zx8f7SoM/Cs43hXxOghQRnyxKeYUkI+F5oYtfFq/ X-Received: by 10.15.111.202 with SMTP id cj50mr145983eeb.71.1383481504302; Sun, 03 Nov 2013 04:25:04 -0800 (PST) Received: from localhost (dsl-hkibrasgw2-58c36f-91.dhcp.inet.fi. [88.195.111.91]) by mx.google.com with ESMTPSA id i1sm32877757eeg.0.2013.11.03.04.25.02 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Sun, 03 Nov 2013 04:25:03 -0800 (PST) From: Jani Nikula To: notmuch@notmuchmail.org Subject: [PATCH v2 04/11] lib: do not leak the database in compaction Date: Sun, 3 Nov 2013 14:24:44 +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:19 -0000 Destroy instead of close the database after compaction, and also on error path, to not leak the database. --- lib/database.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/database.cc b/lib/database.cc index 7a8702e..eadf8a7 100644 --- a/lib/database.cc +++ b/lib/database.cc @@ -941,10 +941,12 @@ notmuch_database_compact (const char* path, goto DONE; } - notmuch_database_close(notmuch); - DONE: + if (notmuch) + notmuch_database_destroy (notmuch); + talloc_free(local); + return ret; } #else -- 1.8.4.rc3