mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-10-30 18:03:32 +00:00
conf: fix g_new0 allocation
Fixes commit <a5d88ffe0ad9b5d5314ab0058c5b363f9f79b8ee> which changed allocation from VIR_ALLOC_N to g_new0 but missed some +1 on number of allocated elements. Signed-off-by: Pavel Hrdina <phrdina@redhat.com> Reviewed-by: Laine Stump <laine@redhat.com>
This commit is contained in:
parent
accdc0e773
commit
8a666dccda
@ -320,7 +320,7 @@ virInterfaceObjListExport(virConnectPtr conn,
|
||||
|
||||
virObjectRWLockRead(ifaceobjs);
|
||||
if (ifaces)
|
||||
data.ifaces = g_new0(virInterfacePtr, virHashSize(ifaceobjs->objsName));
|
||||
data.ifaces = g_new0(virInterfacePtr, virHashSize(ifaceobjs->objsName) + 1);
|
||||
|
||||
virHashForEach(ifaceobjs->objsName, virInterfaceObjListExportCallback, &data);
|
||||
|
||||
|
@ -1407,7 +1407,7 @@ virNetworkObjListExport(virConnectPtr conn,
|
||||
|
||||
virObjectRWLockRead(netobjs);
|
||||
if (nets)
|
||||
data.nets = g_new0(virNetworkPtr, virHashSize(netobjs->objs));
|
||||
data.nets = g_new0(virNetworkPtr, virHashSize(netobjs->objs) + 1);
|
||||
|
||||
virHashForEach(netobjs->objs, virNetworkObjListExportCallback, &data);
|
||||
|
||||
@ -1801,7 +1801,7 @@ virNetworkObjPortListExport(virNetworkPtr net,
|
||||
if (ports) {
|
||||
*ports = NULL;
|
||||
|
||||
data.ports = g_new0(virNetworkPortPtr, virHashSize(obj->ports));
|
||||
data.ports = g_new0(virNetworkPortPtr, virHashSize(obj->ports) + 1);
|
||||
}
|
||||
|
||||
virHashForEach(obj->ports, virNetworkObjPortListExportCallback, &data);
|
||||
|
@ -931,7 +931,7 @@ virNodeDeviceObjListExport(virConnectPtr conn,
|
||||
|
||||
virObjectRWLockRead(devs);
|
||||
if (devices)
|
||||
data.devices = g_new0(virNodeDevicePtr, virHashSize(devs->objs));
|
||||
data.devices = g_new0(virNodeDevicePtr, virHashSize(devs->objs) + 1);
|
||||
|
||||
virHashForEach(devs->objs, virNodeDeviceObjListExportCallback, &data);
|
||||
virObjectRWUnlock(devs);
|
||||
|
Loading…
Reference in New Issue
Block a user