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

Signed-off-by: Sudip Mukherjee <sudip.mukher...@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

Reply via email to