mirror of
https://gitlab.com/qemu-project/qemu.git
synced 2026-10-28 11:54:41 +08:00
backends/igvm: fix parameter area entries leak
qigvm_directive_parameter_area() allocates a QIgvmParameterData entry
for each parameter area, allocates the data buffer, and queues it in
the list.
At the end of qigvm_process_file() we iterate the list to only free
the data buffer of each entry, but never the entry itself, so all of
them are leaked.
Let's also free the entry itself and remove it from the list. We could
avoid the removal since the list lives on the stack, but it's better to
leave the list consistent.
Fixes: c1d466d267 ("backends/igvm: Add IGVM loader and configuration")
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
Message-ID: <20261021082459.72038-1-sgarzare@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
This commit is contained in:
1 parent
edd5339a08
commit
966572648f
1 file changed
+4
-3
+4
-3
@@ -1086,7 +1086,7 @@ int qigvm_process_file(IgvmCfg *cfg, MachineState *machine_state,
|
||||
bool onlyVpContext, Error **errp)
|
||||
{
|
||||
int32_t header_count;
|
||||
QIgvmParameterData *parameter;
|
||||
QIgvmParameterData *parameter, *tmp;
|
||||
int retval = -1;
|
||||
QIgvm ctx;
|
||||
|
||||
@@ -1186,10 +1186,11 @@ int qigvm_process_file(IgvmCfg *cfg, MachineState *machine_state,
|
||||
retval = qigvm_process_mem_page(&ctx, NULL, errp);
|
||||
|
||||
cleanup_parameters:
|
||||
QTAILQ_FOREACH(parameter, &ctx.parameter_data, next)
|
||||
QTAILQ_FOREACH_SAFE(parameter, &ctx.parameter_data, next, tmp)
|
||||
{
|
||||
QTAILQ_REMOVE(&ctx.parameter_data, parameter, next);
|
||||
g_free(parameter->data);
|
||||
parameter->data = NULL;
|
||||
g_free(parameter);
|
||||
}
|
||||
g_free(ctx.id_block);
|
||||
g_free(ctx.id_auth);
|
||||
|
||||
Reference in new issue
Block a user