mirror of https://gitee.com/openkylin/libvirt.git
conf: fix NULL deref when exporting ports
Reviewed-by: John Ferlan <jferlan@redhat.com> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
parent
cce545ddb6
commit
520f5752be
|
@ -1810,10 +1810,12 @@ virNetworkObjPortListExport(virNetworkPtr net,
|
|||
};
|
||||
int ret = -1;
|
||||
|
||||
*ports = NULL;
|
||||
if (ports) {
|
||||
*ports = NULL;
|
||||
|
||||
if (ports && VIR_ALLOC_N(data.ports, virHashSize(obj->ports) + 1) < 0)
|
||||
goto cleanup;
|
||||
if (VIR_ALLOC_N(data.ports, virHashSize(obj->ports) + 1) < 0)
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
virHashForEach(obj->ports, virNetworkObjPortListExportCallback, &data);
|
||||
|
||||
|
|
Loading…
Reference in New Issue