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

Tyler Hicks tyhicks at canonical.com
Wed Mar 25 22:37:16 UTC 2015


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>
---
 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




More information about the AppArmor mailing list