提交 23419a62 编写于 作者: M Michal Privoznik

bhyveConnectGetCapabilities: Fix double caps unref

At the beginning of the function we gain a reference to the driver
capabilities. Then, we call format function (*) which if failed, unref
over caps is called. Then, at the end another unref occurs.

* - Moreover, the format was not called over gained caps, but over
privconn->caps directly which is not allowed anymore.
Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
上级 17b17565
...@@ -135,22 +135,24 @@ bhyveConnectGetCapabilities(virConnectPtr conn) ...@@ -135,22 +135,24 @@ bhyveConnectGetCapabilities(virConnectPtr conn)
{ {
bhyveConnPtr privconn = conn->privateData; bhyveConnPtr privconn = conn->privateData;
virCapsPtr caps; virCapsPtr caps;
char *xml; char *xml = NULL;
if (virConnectGetCapabilitiesEnsureACL(conn) < 0) if (virConnectGetCapabilitiesEnsureACL(conn) < 0)
return NULL; return NULL;
caps = bhyveDriverGetCapabilities(privconn); if (!(caps = bhyveDriverGetCapabilities(privconn))) {
if (!caps)
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("Unable to get Capabilities")); _("Unable to get Capabilities"));
goto cleanup;
}
if ((xml = virCapabilitiesFormatXML(privconn->caps)) == NULL) { if (!(xml = virCapabilitiesFormatXML(caps))) {
virObjectUnref(caps);
virReportOOMError(); virReportOOMError();
goto cleanup;
} }
virObjectUnref(caps);
cleanup:
virObjectUnref(caps);
return xml; return xml;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册