From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by arlo.cworth.org (Postfix) with ESMTP id 224136DE0355 for ; Sat, 26 Aug 2017 07:42:02 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at cworth.org X-Spam-Flag: NO X-Spam-Score: 0 X-Spam-Level: X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[AWL=0.011, SPF_PASS=-0.001, T_RP_MATCHES_RCVD=-0.01] autolearn=disabled Received: from arlo.cworth.org ([127.0.0.1]) by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 6KX_LY39A75V for ; Sat, 26 Aug 2017 07:42:01 -0700 (PDT) Received: from fethera.tethera.net (fethera.tethera.net [198.245.60.197]) by arlo.cworth.org (Postfix) with ESMTPS id DA6506DE0962 for ; Sat, 26 Aug 2017 07:42:00 -0700 (PDT) Received: from remotemail by fethera.tethera.net with local (Exim 4.89) (envelope-from ) id 1dlcEC-00039Y-DB; Sat, 26 Aug 2017 10:38:24 -0400 Received: (nullmailer pid 11248 invoked by uid 1000); Sat, 26 Aug 2017 14:41:55 -0000 From: David Bremner 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 Message-Id: <20170826144141.11140-3-david@tethera.net> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20170826144141.11140-1-david@tethera.net> References: <20170826144141.11140-1-david@tethera.net> X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 26 Aug 2017 14:42:02 -0000 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