From: David Bremner <david@tethera.net>
To: notmuch@notmuchmail.org, notmuch@freelists.org
Subject: [PATCH 2/5] cppcheck: close files during shutdown
Date: Sat, 26 Aug 2017 11:41:38 -0300 [thread overview]
Message-ID: <20170826144141.11140-3-david@tethera.net> (raw)
In-Reply-To: <20170826144141.11140-1-david@tethera.net>
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.14.1
next prev parent reply other threads:[~2017-08-26 14:42 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-26 14:41 make notmuch cppcheck clean David Bremner
2017-08-26 14:41 ` [PATCH 1/5] build: add target to run cppcheck David Bremner
2017-08-27 8:20 ` Jani Nikula
2017-08-29 11:35 ` [Patch v2] " David Bremner
2017-08-29 18:36 ` Jani Nikula
2017-08-29 18:47 ` Jani Nikula
2017-08-30 23:28 ` David Bremner
2017-08-26 14:41 ` David Bremner [this message]
2017-08-26 14:41 ` [PATCH 3/5] cppcheck: call va_end in _internal_error David Bremner
2017-08-26 14:41 ` [PATCH 4/5] test/smtp-dummy: uncrustify David Bremner
2017-08-26 14:41 ` [PATCH 5/5] test/smtp-dummy: convert to 'goto DONE' style 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=20170826144141.11140-3-david@tethera.net \
--to=david@tethera.net \
--cc=notmuch@freelists.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).