[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1460463119-8409-1-git-send-email-sudipm.mukherjee@gmail.com>
Date: Tue, 12 Apr 2016 17:41:59 +0530
From: Sudip Mukherjee <sudipm.mukherjee@...il.com>
To: David Howells <dhowells@...hat.com>
Cc: linux-kernel@...r.kernel.org,
Sudip Mukherjee <sudipm.mukherjee@...il.com>
Subject: [PATCH] KEYS: fix memory leak
If the file read fails then we returned NULL as error but we missed
freeing buf.
Signed-off-by: Sudip Mukherjee <sudip.mukherjee@...ethink.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
Powered by blists - more mailing lists