2
0
mirror of https://gitlab.com/apparmor/apparmor synced 2025-08-21 17:47:10 +00:00

parser: fix leaking name in variable expansion

Fixes: https://gitlab.com/apparmor/apparmor/-/issues/533
Signed-off-by: Georgia Garcia <georgia.garcia@canonical.com>
This commit is contained in:
Georgia Garcia 2025-08-04 18:54:36 -03:00
parent 8b2e2c3358
commit b8dee97ed3

View File

@ -307,6 +307,7 @@ int variable::expand_variable()
}
name = variable::process_var(var.c_str());
variable *ref = symtab::lookup_existing_symbol(name);
free(name);
if (!ref) {
PERROR("Failed to find declaration for: %s\n", var.c_str());
rc = 1;
@ -336,7 +337,6 @@ int variable::expand_variable()
}
out:
free(name);
expanding = false;
return rc;
}