Sudip Mukherjee <[email protected]> wrote:

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

It's not a particularly critical error since it's a build-time script rather
than the kernel.  Possibly read_file() and map_file() should just exit upon
encountering an error rather than returning.

David

> 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);

Reply via email to