mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Gaurav Singh <gaurav1086@gmail.com>
To: gaurav1086@gmail.com, linux-kernel@vger.kernel.org (open list)
Subject: [PATCH] [scripts] read_file: fix memory leak
Date: Sun, 28 Jun 2020 21:21:33 -0400	[thread overview]
Message-ID: <20200629012149.29839-1-gaurav1086@gmail.com> (raw)
In-Reply-To: <20200621165657.9814-1-gaurav1086@gmail.com>

Free buf before returning to avoid memory leak.

Signed-off-by: Gaurav Singh <gaurav1086@gmail.com>
---
 scripts/insert-sys-cert.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/scripts/insert-sys-cert.c b/scripts/insert-sys-cert.c
index 8902836c2342..22d99a8faca9 100644
--- a/scripts/insert-sys-cert.c
+++ b/scripts/insert-sys-cert.c
@@ -250,6 +250,7 @@ static char *read_file(char *file_name, int *size)
 	}
 	if (read(fd, buf, *size) != *size) {
 		perror("File read failed");
+		free(buf);
 		close(fd);
 		return NULL;
 	}
-- 
2.17.1


      parent reply	other threads:[~2020-06-29  1:22 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-21 16:56 [PATCH] [net] dcb_doit: remove redundant skb check Gaurav Singh
2020-06-22 19:35 ` Jakub Kicinski
2020-06-23  2:50 ` Gaurav Singh
2020-06-24  3:27   ` David Miller
2020-06-29  1:21 ` Gaurav Singh [this message]

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=20200629012149.29839-1-gaurav1086@gmail.com \
    --to=gaurav1086@gmail.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®