[PATCH v2 11/25] [libx11] Fixed memory leak by adding Xfree

Alan Coopersmith alan.coopersmith at oracle.com
Mon Jan 31 23:24:32 PST 2011


On 01/31/11 04:02 AM, Erkki Seppälä wrote:
> Variable "image" goes out of scope
> 
> Reviewed-by: Ander Conselvan de Oliveira <ander.conselvan-de-oliveira at nokia.com>
> Signed-off-by: Erkki Seppälä <erkki.seppala at vincit.fi>
> ---
>  src/ImUtil.c |    1 +
>  1 files changed, 1 insertions(+), 0 deletions(-)
> 
> diff --git a/src/ImUtil.c b/src/ImUtil.c
> index cd418d8..3164d43 100644
> --- a/src/ImUtil.c
> +++ b/src/ImUtil.c
> @@ -372,6 +372,7 @@ XImage *XCreateImage (
>  	if (image_bytes_per_line == 0) {
>  	    image->bytes_per_line = min_bytes_per_line;
>  	} else if (image_bytes_per_line < min_bytes_per_line) {
> +	    Xfree(image);
>  	    return NULL;
>  	} else {
>  	    image->bytes_per_line = image_bytes_per_line;

Reviewed-by: Alan Coopersmith <alan.coopersmith at oracle.com>

-- 
	-Alan Coopersmith-        alan.coopersmith at oracle.com
	 Oracle Solaris Platform Engineering: X Window System



More information about the xorg-devel mailing list