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@xxxxxxx> --- checkpolicy/module_compiler.c | 1 + 1 file changed, 1 insertion(+) diff --git a/checkpolicy/module_compiler.c b/checkpolicy/module_compiler.c index 155702f2731b..ada7cb2ae9c7 100644 --- a/checkpolicy/module_compiler.c +++ b/checkpolicy/module_compiler.c @@ -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 = -- 2.17.0 _______________________________________________ Selinux mailing list Selinux@xxxxxxxxxxxxx To unsubscribe, send email to Selinux-leave@xxxxxxxxxxxxx. To get help, send an email containing "help" to Selinux-request@xxxxxxxxxxxxx.