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.
This commit is contained in:
David Bremner 2017-08-26 11:41:38 -03:00
parent af64530d3f
commit c960bb4686
2 changed files with 4 additions and 0 deletions

View file

@ -204,6 +204,8 @@ notmuch_count_command (notmuch_config_t *config, int argc, char *argv[])
if (batch && opt_index != argc) { if (batch && opt_index != argc) {
fprintf (stderr, "--batch and query string are not compatible\n"); fprintf (stderr, "--batch and query string are not compatible\n");
if (input)
fclose (input);
return EXIT_FAILURE; return EXIT_FAILURE;
} }

View file

@ -235,6 +235,8 @@ notmuch_tag_command (notmuch_config_t *config, int argc, char *argv[])
if (batch) { if (batch) {
if (opt_index != argc) { if (opt_index != argc) {
fprintf (stderr, "Can't specify both cmdline and stdin!\n"); fprintf (stderr, "Can't specify both cmdline and stdin!\n");
if (input)
fclose (input);
return EXIT_FAILURE; return EXIT_FAILURE;
} }
} else { } else {