1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2025-03-07 17:28:15 +00:00

qemu: agent: fix array access

My code movement changed the type of ifaces_ret from
virDomainInterfacePtr * to virDomainInterfacePtr **,
but failed to adjust the condition or dereference the
array correctly.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Fixes: 6ddb1f803ea38d8d709b984fa9539e34318a9dc0
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
Ján Tomko 2020-10-15 14:54:39 +02:00
parent b6fea3f5d8
commit 92ac61ea5e

View File

@ -2209,6 +2209,7 @@ qemuAgentGetAllInterfaceAddresses(virDomainInterfacePtr **ifaces_ret,
size_t ifaces_count = 0;
size_t i;
*ifaces_ret = NULL;
/* Hash table to handle the interface alias */
ifaces_store = virHashNew(NULL);
@ -2223,9 +2224,9 @@ qemuAgentGetAllInterfaceAddresses(virDomainInterfacePtr **ifaces_ret,
return ifaces_count;
error:
if (ifaces_ret) {
if (*ifaces_ret) {
for (i = 0; i < ifaces_count; i++)
virDomainInterfaceFree(*ifaces_ret[i]);
virDomainInterfaceFree((*ifaces_ret)[i]);
}
VIR_FREE(*ifaces_ret);
return -1;