Skip to content

Commit

Permalink
libsepol/cil: Destroy classperm list when resetting map perms
Browse files Browse the repository at this point in the history
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.

Signed-off-by: James Carter <jwcart2@gmail.com>
  • Loading branch information
jwcart2 committed Apr 19, 2021
1 parent f34d3d3 commit 2d35fcc
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion libsepol/cil/src/cil_reset_ast.c
Expand Up @@ -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)
Expand Down

0 comments on commit 2d35fcc

Please sign in to comment.