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: <20170220104636.GA4607@localhost.localdomain>
Date:   Mon, 20 Feb 2017 16:16:36 +0530
From:   Saurabh Badhwar <sbsaurabhbadhwar9@...il.com>
To:     linux-kernel@...r.kernel.org
Cc:     kernel-janitors@...r.kernel.org
Subject: [PATCH v2] tools/vm: Fix possible resource leak in page_owner_sort.c

The patch addresses explicit closing of file pointers on exit
and redirects the errors to the stderr
Signed-off-by: Saurabh Badhwar <sbsaurabhbadhwar9@...il.com>
---
 tools/vm/page_owner_sort.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/vm/page_owner_sort.c b/tools/vm/page_owner_sort.c
index 8346261..b3c3efa 100644
--- a/tools/vm/page_owner_sort.c
+++ b/tools/vm/page_owner_sort.c
@@ -109,7 +109,7 @@ int main(int argc, char **argv)
 	list = malloc(max_size * sizeof(*list));
 	buf = malloc(BUF_SIZE);
 	if (!list || !buf) {
-		printf("Out of memory\n");
+		perror("Unable to allocate memory: ");
 		fclose(fin);
 		fclose(fout);
 		exit(1);
@@ -145,8 +145,8 @@ int main(int argc, char **argv)
 	qsort(list2, count, sizeof(list[0]), compare_num);
 
 	for (i = 0; i < count; i++)
-		fprintf(fout, "%d times:\n%s\n", list2[i].num, list2[i].txt);
-		
+		fprintf(fout, "%d times:\n%s\n", list2[i].num, list2[i].txt);	
+	
 	fclose(fout);
 	return 0;
 }
-- 
2.9.3

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ