[apparmor] [PATCH 1/6] libapparmor: Fix memory leak when freeing aa_policy_cache objects

Steve Beattie steve at nxnw.org
Wed Mar 25 23:23:06 UTC 2015


On Wed, Mar 25, 2015 at 05:37:16PM -0500, Tyler Hicks wrote:
> The two internal aa_features objects weren't being unreferenced when the
> aa_policy_cache object was being freed.
> 
> Signed-off-by: Tyler Hicks <tyhicks at canonical.com>
Acked-by: Steve Beattie <steve at nxnw.org>

Thanks.

> ---
>  libraries/libapparmor/src/policy_cache.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/libraries/libapparmor/src/policy_cache.c b/libraries/libapparmor/src/policy_cache.c
> index 98155a6..a9e43bb 100644
> --- a/libraries/libapparmor/src/policy_cache.c
> +++ b/libraries/libapparmor/src/policy_cache.c
> @@ -203,6 +203,8 @@ aa_policy_cache *aa_policy_cache_ref(aa_policy_cache *policy_cache)
>  void aa_policy_cache_unref(aa_policy_cache *policy_cache)
>  {
>  	if (policy_cache && atomic_dec_and_test(&policy_cache->ref_count)) {
> +		aa_features_unref(policy_cache->kernel_features);
> +		aa_features_unref(policy_cache->features);
>  		free(policy_cache->features_path);
>  		free(policy_cache->path);
>  		free(policy_cache);
> -- 
> 2.1.4
> 
> 
> -- 
> AppArmor mailing list
> AppArmor at lists.ubuntu.com
> Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/apparmor

-- 
Steve Beattie
<sbeattie at ubuntu.com>
http://NxNW.org/~steve/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <https://lists.ubuntu.com/archives/apparmor/attachments/20150325/241d1744/attachment.pgp>


More information about the AppArmor mailing list