Skip to content

Commit b325348

Browse files
cgzonesjwcart2
authored andcommitted
checkpolicy: free ebitmap on error in define_compute_type_helper()
Free the local ebitmap for classes in define_compute_type_helper() on error. Reported-by: oss-fuzz (issue 403364352) Signed-off-by: Christian Göttsche <[email protected]> Acked-by: James Carter <[email protected]>
1 parent bdcbbf8 commit b325348

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

checkpolicy/policy_define.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1700,6 +1700,8 @@ static int define_compute_type_helper(int which, avrule_t ** rule)
17001700
return -1;
17011701
}
17021702

1703+
ebitmap_init(&tclasses);
1704+
17031705
while ((id = queue_remove(id_queue))) {
17041706
if (set_types(&avrule->stypes, id, &add, 0))
17051707
goto bad;
@@ -1719,7 +1721,6 @@ static int define_compute_type_helper(int which, avrule_t ** rule)
17191721
goto bad;
17201722
}
17211723

1722-
ebitmap_init(&tclasses);
17231724
if (read_classes(&tclasses))
17241725
goto bad;
17251726

@@ -1760,6 +1761,7 @@ static int define_compute_type_helper(int which, avrule_t ** rule)
17601761
return 0;
17611762

17621763
bad:
1764+
ebitmap_destroy(&tclasses);
17631765
avrule_destroy(avrule);
17641766
free(avrule);
17651767
return -1;

0 commit comments

Comments
 (0)