libsepol/cil: free bitmaps in cil_level_equals()

cil_level_equals() builds two bitmap and compare them but does not
destroy them before returning the result.

This memory leak has been found by running clang's Address Sanitizer on
a set of policies generated by American Fuzzy Lop.

Signed-off-by: Nicolas Iooss <nicolas.iooss@m4x.org>
This commit is contained in:
Nicolas Iooss 2017-02-19 11:30:58 +01:00 committed by James Carter
parent 9feaf0380d
commit 95e5c103f3

View File

@ -1299,7 +1299,9 @@ static int cil_level_equals(struct cil_level *low, struct cil_level *high)
goto exit;
}
return ebitmap_cmp(&elow, &ehigh);
rc = ebitmap_cmp(&elow, &ehigh);
ebitmap_destroy(&elow);
ebitmap_destroy(&ehigh);
exit:
return rc;