From c960bb4686429b220419f6d45ede920d6c14c3c5 Mon Sep 17 00:00:00 2001 From: David Bremner Date: Sat, 26 Aug 2017 11:41:38 -0300 Subject: [PATCH] cppcheck: close files during shutdown Fix the following cppcheck errors: notmuch-count.c:207: error: Resource leak: input notmuch-tag.c:238: error: Resource leak: input We know that the program is shutting down here, but it does no harm to clean up a bit. --- notmuch-count.c | 2 ++ notmuch-tag.c | 2 ++ 2 files changed, 4 insertions(+) diff --git a/notmuch-count.c b/notmuch-count.c index 50b0c193..97281374 100644 --- a/notmuch-count.c +++ b/notmuch-count.c @@ -204,6 +204,8 @@ notmuch_count_command (notmuch_config_t *config, int argc, char *argv[]) if (batch && opt_index != argc) { fprintf (stderr, "--batch and query string are not compatible\n"); + if (input) + fclose (input); return EXIT_FAILURE; } diff --git a/notmuch-tag.c b/notmuch-tag.c index 9c03754d..130de634 100644 --- a/notmuch-tag.c +++ b/notmuch-tag.c @@ -235,6 +235,8 @@ notmuch_tag_command (notmuch_config_t *config, int argc, char *argv[]) if (batch) { if (opt_index != argc) { fprintf (stderr, "Can't specify both cmdline and stdin!\n"); + if (input) + fclose (input); return EXIT_FAILURE; } } else { -- 2.26.2