]> git.notmuchmail.org Git - notmuch/blobdiff - notmuch.c
cli: close config and do talloc report also on errors
[notmuch] / notmuch.c
index 2d7f33d3d8d69c0c9418f57c428bd78c0b7f27ec..b3fa9f3785459676152f2b9e04ddf50bb777e36f 100644 (file)
--- 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;