mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] KEYS: fix memory leak
@ 2016-04-12 12:11 Sudip Mukherjee
  2016-04-12 18:06 ` David Howells
  0 siblings, 1 reply; 2+ messages in thread
From: Sudip Mukherjee @ 2016-04-12 12:11 UTC (permalink / raw)
  To: David Howells; +Cc: linux-kernel, Sudip Mukherjee

If the file read fails then we returned NULL as error but we missed
freeing buf.

Signed-off-by: Sudip Mukherjee <sudip.mukherjee@codethink.co.uk>
---
 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 8902836..b98a0b1 100644
--- a/scripts/insert-sys-cert.c
+++ b/scripts/insert-sys-cert.c
@@ -251,6 +251,7 @@ static char *read_file(char *file_name, int *size)
 	if (read(fd, buf, *size) != *size) {
 		perror("File read failed");
 		close(fd);
+		free(buf);
 		return NULL;
 	}
 	close(fd);
-- 
1.9.1

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-04-12 18:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-12 12:11 [PATCH] KEYS: fix memory leak Sudip Mukherjee
2016-04-12 18:06 ` David Howells

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®