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