checkpolicy: destroy the class datum if it fails to initialize
require_class() allocate memory for its variable "class_datum_t *datum" and calls symtab_init(&datum->permissions, PERM_SYMTAB_SIZE). If this second call fails, datum is not freed. Fix this memory leak. Signed-off-by: Nicolas Iooss <nicolas.iooss@m4x.org>
This commit is contained in:
parent
29636c5ddc
commit
daa00b2899
|
@ -802,6 +802,7 @@ int require_class(int pass)
|
|||
if ((datum = calloc(1, sizeof(*datum))) == NULL ||
|
||||
symtab_init(&datum->permissions, PERM_SYMTAB_SIZE)) {
|
||||
yyerror("Out of memory!");
|
||||
class_datum_destroy(datum);
|
||||
return -1;
|
||||
}
|
||||
ret =
|
||||
|
|
Loading…
Reference in New Issue