2
0
mirror of https://gitlab.com/apparmor/apparmor synced 2025-08-22 10:07:12 +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()); name = variable::process_var(var.c_str());
variable *ref = symtab::lookup_existing_symbol(name); variable *ref = symtab::lookup_existing_symbol(name);
free(name);
if (!ref) { if (!ref) {
PERROR("Failed to find declaration for: %s\n", var.c_str()); PERROR("Failed to find declaration for: %s\n", var.c_str());
rc = 1; rc = 1;
@ -336,7 +337,6 @@ int variable::expand_variable()
} }
out: out:
free(name);
expanding = false; expanding = false;
return rc; return rc;
} }