lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:	Tue, 12 Apr 2016 19:06:13 +0100
From:	David Howells <dhowells@...hat.com>
To:	Sudip Mukherjee <sudipm.mukherjee@...il.com>
Cc:	dhowells@...hat.com, linux-kernel@...r.kernel.org,
	mkayaalp@...ux.vnet.ibm.com
Subject: Re: [PATCH] KEYS: fix memory leak

Sudip Mukherjee <sudipm.mukherjee@...il.com> 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);

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ