mirror of
https://github.com/JakeHillion/drgn.git
synced 2024-12-22 09:13:06 +00:00
libdrgn: fix memory leak of type template parameters
We never free drgn_type::template_parameters.
Fixes: 352c31e1ac
("Add support for C++ template parameters")
Signed-off-by: Omar Sandoval <osandov@osandov.com>
This commit is contained in:
parent
d22f434600
commit
71a65dbfb1
@ -1291,6 +1291,15 @@ void drgn_program_deinit_types(struct drgn_program *prog)
|
||||
drgn_lazy_object_deinit(¶meters[j].default_argument);
|
||||
free(parameters);
|
||||
}
|
||||
if (drgn_type_has_template_parameters(type)) {
|
||||
struct drgn_type_template_parameter *template_parameters =
|
||||
drgn_type_template_parameters(type);
|
||||
size_t num_template_parameters =
|
||||
drgn_type_num_template_parameters(type);
|
||||
for (size_t j = 0; j < num_template_parameters; j++)
|
||||
drgn_lazy_object_deinit(&template_parameters[j].argument);
|
||||
free(template_parameters);
|
||||
}
|
||||
free(type);
|
||||
}
|
||||
drgn_typep_vector_deinit(&prog->created_types);
|
||||
|
Loading…
Reference in New Issue
Block a user