Re: libselinux/matchpathcon has a memory leak

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

 



On Fri, 2008-03-14 at 15:27 -0400, Eamon Walsh wrote:
> Here is a new version of the patch.
> 
> The clearing out of the data instead of freeing it is a leftover from 
> when that was a global variable.  That was the cause of the leak I 
> thought was the result of a missing matchpathcon_fini().
> 
> Signed-off-by: Eamon Walsh <ewalsh@xxxxxxxxxxxxx>

Merged.  Note that the Fedora patch must be reverted or you'll get a
double free when re-basing to this one.

> ---
> 
> Index: src/label_file.c
> ===================================================================
> --- src/label_file.c	(revision 2848)
> +++ src/label_file.c	(working copy)
> @@ -562,7 +562,7 @@
>  	if (data->stem_arr)
>  		free(data->stem_arr);
>  	
> -	memset(data, 0, sizeof(*data));
> +	free(data);
>  }
>  
>  static struct selabel_lookup_rec *lookup(struct selabel_handle *rec,
> Index: src/label.c
> ===================================================================
> --- src/label.c	(revision 2848)
> +++ src/label.c	(working copy)
> @@ -95,7 +95,7 @@
>  	if (compat_validate(rec, lr, "file_contexts", 0))
>  		return NULL;
>  
> -	if (translating &&
> +	if (translating && !lr->ctx_trans &&
>  	    selinux_raw_to_trans_context(lr->ctx_raw, &lr->ctx_trans))
>  		return NULL;
>  
> 
> 
> 
> 
-- 
Stephen Smalley
National Security Agency


--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to majordomo@xxxxxxxxxxxxx with
the words "unsubscribe selinux" without quotes as the message.

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

  Powered by Linux