mirror of
https://github.com/SELinuxProject/selinux
synced 2025-03-07 02:37:41 +00:00
checkpolicy: always free id in define_type()
In function define_type(), some error conditions between "id = queue_remove(id_queue)" and "get_local_type(id, attr->s.value, 1)" returned without freeing id. Fix theses memory leaks. Signed-off-by: Nicolas Iooss <nicolas.iooss@m4x.org>
This commit is contained in:
parent
4a05e95f19
commit
aa1a8a3c84
@ -1426,11 +1426,13 @@ int define_type(int alias)
|
||||
if (!attr) {
|
||||
/* treat it as a fatal error */
|
||||
yyerror2("attribute %s is not declared", id);
|
||||
free(id);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (attr->flavor != TYPE_ATTRIB) {
|
||||
yyerror2("%s is a type, not an attribute", id);
|
||||
free(id);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user