RE: [PATCH] mcstransd: fix memory leak in new_context_str

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> -----Original Message-----
> From: selinux-owner@xxxxxxxxxxxxxxx [mailto:selinux-owner@xxxxxxxxxxxxxxx]
> On Behalf Of bauen1
> Sent: Tuesday, May 12, 2020 12:53 PM
> To: selinux <selinux@xxxxxxxxxxxxxxx>
> Subject: [PATCH] mcstransd: fix memory leak in new_context_str
> 
> The return value of context_new needs to be free with context_free.
> 
> Signed-off-by: bauen1 <j2468h@xxxxxxxxx>
> ---
>  mcstrans/src/mcstrans.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/mcstrans/src/mcstrans.c b/mcstrans/src/mcstrans.c index
> 96bdbdff..2116b161 100644
> --- a/mcstrans/src/mcstrans.c
> +++ b/mcstrans/src/mcstrans.c
> @@ -919,6 +919,7 @@ new_context_str(const security_context_t incon, const
> char *range) {
>  	}
>  	context_range_set(con, range);
>  	rcon = strdup(context_str(con));
> +	context_free(con);
>  	if (!rcon) {
>  		goto exit;
>  	}
> --
> 2.26.2

Acked-by: William Roberts <william.c.roberts@xxxxxxxxx>




[Index of Archives]     [Selinux Refpolicy]     [Linux SGX]     [Fedora Users]     [Fedora Desktop]     [Yosemite Photos]     [Yosemite Camping]     [Yosemite Campsites]     [KDE Users]     [Gnome Users]

  Powered by Linux