unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Jani Nikula <jani@nikula.org>
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	[thread overview]
Message-ID: <1389389334-24138-2-git-send-email-jani@nikula.org> (raw)
In-Reply-To: <1389389334-24138-1-git-send-email-jani@nikula.org>

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

  reply	other threads:[~2014-01-10 21:29 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-10 21:28 [PATCH 1/2] cli: clean up exit status code returned by the cli commands Jani Nikula
2014-01-10 21:28 ` Jani Nikula [this message]
2014-01-11 10:22 ` Tomi Ollila
2014-01-18 13:09   ` Mark Walters
2014-01-19  0:08 ` David Bremner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1389389334-24138-2-git-send-email-jani@nikula.org \
    --to=jani@nikula.org \
    --cc=notmuch@notmuchmail.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).