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:
parent
b6fea3f5d8
commit
92ac61ea5e
@ -2209,6 +2209,7 @@ qemuAgentGetAllInterfaceAddresses(virDomainInterfacePtr **ifaces_ret,
|
|||||||
size_t ifaces_count = 0;
|
size_t ifaces_count = 0;
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
|
*ifaces_ret = NULL;
|
||||||
/* Hash table to handle the interface alias */
|
/* Hash table to handle the interface alias */
|
||||||
ifaces_store = virHashNew(NULL);
|
ifaces_store = virHashNew(NULL);
|
||||||
|
|
||||||
@ -2223,9 +2224,9 @@ qemuAgentGetAllInterfaceAddresses(virDomainInterfacePtr **ifaces_ret,
|
|||||||
return ifaces_count;
|
return ifaces_count;
|
||||||
|
|
||||||
error:
|
error:
|
||||||
if (ifaces_ret) {
|
if (*ifaces_ret) {
|
||||||
for (i = 0; i < ifaces_count; i++)
|
for (i = 0; i < ifaces_count; i++)
|
||||||
virDomainInterfaceFree(*ifaces_ret[i]);
|
virDomainInterfaceFree((*ifaces_ret)[i]);
|
||||||
}
|
}
|
||||||
VIR_FREE(*ifaces_ret);
|
VIR_FREE(*ifaces_ret);
|
||||||
return -1;
|
return -1;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user