提交 520f5752 编写于 作者: D Daniel P. Berrangé

conf: fix NULL deref when exporting ports

Reviewed-by: NJohn Ferlan <jferlan@redhat.com>
Signed-off-by: NDaniel P. Berrangé <berrange@redhat.com>
上级 cce545dd
......@@ -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);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册