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]
Message-Id: <20241007185045.00d57782b2f446acc7a78215@linux-foundation.org>
Date: Mon, 7 Oct 2024 18:50:45 -0700
From: Andrew Morton <akpm@...ux-foundation.org>
To: Vishnu Sanal T <t.v.s10123@...il.com>
Cc: linux-kernel@...r.kernel.org, lasse.collin@...aani.org
Subject: Re: [PATCH] fix: possible memory leak in unxz()

On Sun,  6 Oct 2024 12:55:43 +0530 Vishnu Sanal T <t.v.s10123@...il.com> wrote:

> Fixes possible memory leak in the function unxz() in
> lib/decompress_unxz.c forgets to free the pointer 'in', when
> the statement if (fill == NULL && flush == NULL) is true.
> 
> ...
>
> --- a/lib/decompress_unxz.c
> +++ b/lib/decompress_unxz.c
> @@ -343,13 +343,13 @@ STATIC int INIT unxz(unsigned char *in, long in_size,
>  			}
>  		} while (ret == XZ_OK);
>  
> -		if (must_free_in)
> -			free(in);
> -
>  		if (flush != NULL)
>  			free(b.out);
>  	}
>  
> +	if (must_free_in)
> +		free(in);
> +
>  	if (in_used != NULL)
>  		*in_used += b.in_pos;
>  

Looks correct.

must_free_in needn't exist - `in' is always non-NULL here.  And
free(NULL) is OK anwyay.


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ