lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20170913182116.24694-1-martink@posteo.de>
Date:   Wed, 13 Sep 2017 20:21:16 +0200
From:   Martin Kepplinger <martink@...teo.de>
To:     stefanr@...6.in-berlin.de
Cc:     linux1394-devel@...ts.sourceforge.net,
        linux-kernel@...r.kernel.org, Martin Kepplinger <martink@...teo.de>
Subject: [PATCH] tools: firewire: nosy-dump: fix a resource leak in main()

If option_input and option_output is true two files are opened
consecutively. In case the second fopen() fails, let's fclose()
the first one before returning early.

Signed-off-by: Martin Kepplinger <martink@...teo.de>
---
 tools/firewire/nosy-dump.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tools/firewire/nosy-dump.c b/tools/firewire/nosy-dump.c
index 3179c711bd65..228be406f206 100644
--- a/tools/firewire/nosy-dump.c
+++ b/tools/firewire/nosy-dump.c
@@ -960,6 +960,8 @@ int main(int argc, const char *argv[])
 		output = fopen(option_output, "w");
 		if (output == NULL) {
 			fprintf(stderr, "Could not open %s, %m\n", option_output);
+			if (input)
+				fclose(input);
 			return -1;
 		}
 	}
-- 
2.11.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ