Skip to content

Commit

Permalink
libsepol/cil: Fix detected RESOURCE_LEAK (CWE-772)
Browse files Browse the repository at this point in the history
libsepol-3.6/cil/src/cil_binary.c:902: alloc_fn: Storage is returned from allocation function "cil_malloc".
libsepol-3.6/cil/src/cil_binary.c:902: var_assign: Assigning: "mls_level" = storage returned from "cil_malloc(24UL)".
libsepol-3.6/cil/src/cil_binary.c:903: noescape: Resource "mls_level" is not freed or pointed-to in "mls_level_init".
libsepol-3.6/cil/src/cil_binary.c:905: noescape: Resource "mls_level" is not freed or pointed-to in "mls_level_cpy".
libsepol-3.6/cil/src/cil_binary.c:919: leaked_storage: Variable "mls_level" going out of scope leaks the storage it points to.

Signed-off-by: Vit Mojzis <[email protected]>
Acked-by: James Carter <[email protected]>
  • Loading branch information
vmojzis authored and jwcart2 committed May 1, 2024
1 parent f1dadd1 commit 1f173f8
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions libsepol/cil/src/cil_binary.c
Expand Up @@ -904,6 +904,7 @@ static int cil_sensalias_to_policydb(policydb_t *pdb, struct cil_alias *cil_alia

rc = mls_level_cpy(mls_level, sepol_level->level);
if (rc != SEPOL_OK) {
free(mls_level);
goto exit;
}
sepol_alias->level = mls_level;
Expand Down

0 comments on commit 1f173f8

Please sign in to comment.