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: <20191025073146.23582-1-hewenliang4@huawei.com>
Date:   Fri, 25 Oct 2019 03:31:46 -0400
From:   Hewenliang <hewenliang4@...wei.com>
To:     <zephaniah@...il.com>, <tglx@...utronix.de>, <len.brown@...el.com>,
        <ben@...adent.org.uk>, <swinslow@...il.com>,
        <gregkh@...uxfoundation.org>, <linux-kernel@...r.kernel.org>
CC:     <linfeilong@...wei.com>, <hewenliang4@...wei.com>
Subject: [PATCH] tools/power x86_energy_perf_policy: Fix the leakage of file descriptor in get_pkg_num

we need close the file(fp pointer) before the return of get_pkg_num.

Fixes: 4beec1d75 ("tools/power x86_energy_perf_policy: support HWP.EPP")
Signed-off-by: Hewenliang <hewenliang4@...wei.com>
---
 tools/power/x86/x86_energy_perf_policy/x86_energy_perf_policy.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/power/x86/x86_energy_perf_policy/x86_energy_perf_policy.c b/tools/power/x86/x86_energy_perf_policy/x86_energy_perf_policy.c
index 3fe1eed900d4..165eb4da8a64 100644
--- a/tools/power/x86/x86_energy_perf_policy/x86_energy_perf_policy.c
+++ b/tools/power/x86/x86_energy_perf_policy/x86_energy_perf_policy.c
@@ -1111,6 +1111,7 @@ unsigned int get_pkg_num(int cpu)
 	retval = fscanf(fp, "%d\n", &pkg);
 	if (retval != 1)
 		errx(1, "%s: failed to parse", pathname);
+	fclose(fp);
 	return pkg;
 }
 
-- 
2.19.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ