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>] [day] [month] [year] [list]
Message-Id: <1401495953-22764-1-git-send-email-rickard_strandqvist@spectrumdigital.se>
Date:	Sat, 31 May 2014 02:25:53 +0200
From:	Rickard Strandqvist <rickard_strandqvist@...ctrumdigital.se>
To:	Dominik Brodowski <linux@...inikbrodowski.net>,
	Thomas Renninger <trenn@...e.de>
Cc:	Rickard Strandqvist <rickard_strandqvist@...ctrumdigital.se>,
	linux-kernel@...r.kernel.org
Subject: [PATCH] tools: power: cpupower: bench: parse.c:  Cleaning up use of a non-allocated file resource

Removing the risk of using a non-allocated file resource

Signed-off-by: Rickard Strandqvist <rickard_strandqvist@...ctrumdigital.se>
---
 tools/power/cpupower/bench/parse.c |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/tools/power/cpupower/bench/parse.c b/tools/power/cpupower/bench/parse.c
index 543bba1..abc026a 100644
--- a/tools/power/cpupower/bench/parse.c
+++ b/tools/power/cpupower/bench/parse.c
@@ -103,13 +103,16 @@ FILE *prepare_output(const char *dirname)
 	output = fopen(filename, "w+");
 	if (output == NULL) {
 		perror("fopen");
-		fprintf(stderr, "error: unable to open logfile\n");
+		fprintf(stderr, "error: unable to open logfile: %s\n",
+				filename);
+		goto out;
 	}
 
 	fprintf(stdout, "Logfile: %s\n", filename);
 
-	free(filename);
 	fprintf(output, "#round load sleep performance powersave percentage\n");
+out:
+	free(filename);
 	return output;
 }
 
-- 
1.7.10.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ