All of lore.kernel.org
 help / color / mirror / Atom feed
From: Saurabh Badhwar <sbsaurabhbadhwar9@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: kernel-janitors@vger.kernel.org
Subject: [PATCH] tools/vm: Fix possible resource leak in page_owner_sort.c
Date: Sun, 19 Feb 2017 05:50:16 +0000	[thread overview]
Message-ID: <20170219054949.GA2754@localhost.localdomain> (raw)

Fix possible resource leak in tools/vm/page_owner_sort.c
Signed-off-by: Saurabh Badhwar <sbsaurabhbadhwar9@gmail.com>
---
 tools/vm/page_owner_sort.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

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


WARNING: multiple messages have this Message-ID (diff)
From: Saurabh Badhwar <sbsaurabhbadhwar9@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: kernel-janitors@vger.kernel.org
Subject: [PATCH] tools/vm: Fix possible resource leak in page_owner_sort.c
Date: Sun, 19 Feb 2017 11:19:49 +0530	[thread overview]
Message-ID: <20170219054949.GA2754@localhost.localdomain> (raw)

Fix possible resource leak in tools/vm/page_owner_sort.c
Signed-off-by: Saurabh Badhwar <sbsaurabhbadhwar9@gmail.com>
---
 tools/vm/page_owner_sort.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

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

             reply	other threads:[~2017-02-19  5:50 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-19  5:49 Saurabh Badhwar [this message]
2017-02-19  5:50 ` [PATCH] tools/vm: Fix possible resource leak in page_owner_sort.c Saurabh Badhwar
2017-02-19 13:19 ` walter harms
2017-02-19 13:19   ` walter harms

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170219054949.GA2754@localhost.localdomain \
    --to=sbsaurabhbadhwar9@gmail.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.