semodule_package: do not leak memory when using -u or -s

When using -u and -s options, semodule_package's main() allocates
user_extra and seusers to hold the argument values. These allocated
memory blocks are not freed when main() exits, which leads gcc's Address
Sanitizer to report a memory leak. This occurs for example when building
refpolicy base.pp module.

Signed-off-by: Nicolas Iooss <nicolas.iooss@m4x.org>
This commit is contained in:
Nicolas Iooss 2017-02-27 21:39:30 +01:00 committed by James Carter
parent ed51e23f15
commit 3228889620

View File

@ -257,5 +257,7 @@ int main(int argc, char **argv)
free(file_contexts);
free(outfile);
free(module);
free(seusers);
free(user_extra);
exit(0);
}