Skip to contentSkip to conversation

libsepol/cil: Destroy classperm list when resetting map perms

PATCH New James Carter 1 participant 1 message Mar 17, 2021 SELinux security module

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libsepol/cil: Destroy classperm list when resetting map perms

Map perms share the same struct as regular perms, but only the map perms use the classperms field. This field is a pointer to a list of classperms that is created and added to when resolving classmapping rules, so the map permission doesn't own any of the data in the list and this list should be destroyed when the AST is reset.

When resetting a perm, destroy the classperms list without destroying the data in the list.

---
 libsepol/cil/src/cil_reset_ast.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
libsepol/cil/src/cil_reset_ast.c +1 -1
index 3da1b9a6..47138dc4 100644
@@ -36,7 +36,7 @@ static void cil_reset_class(struct cil_class *class)
 
 static void cil_reset_perm(struct cil_perm *perm)
 {
-	cil_reset_classperms_list(perm->classperms);
+	cil_list_destroy(&perm->classperms, CIL_FALSE);
 }
 
 static inline void cil_reset_classperms(struct cil_classperms *cp)
Signature · 1 line
2.26.2