mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-10 14:57:42 +00:00
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: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
17b17565e6
commit
23419a62c2
@ -135,22 +135,24 @@ bhyveConnectGetCapabilities(virConnectPtr conn)
|
||||
{
|
||||
bhyveConnPtr privconn = conn->privateData;
|
||||
virCapsPtr caps;
|
||||
char *xml;
|
||||
char *xml = NULL;
|
||||
|
||||
if (virConnectGetCapabilitiesEnsureACL(conn) < 0)
|
||||
return NULL;
|
||||
|
||||
caps = bhyveDriverGetCapabilities(privconn);
|
||||
if (!caps)
|
||||
if (!(caps = bhyveDriverGetCapabilities(privconn))) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("Unable to get Capabilities"));
|
||||
|
||||
if ((xml = virCapabilitiesFormatXML(privconn->caps)) == NULL) {
|
||||
virObjectUnref(caps);
|
||||
virReportOOMError();
|
||||
goto cleanup;
|
||||
}
|
||||
virObjectUnref(caps);
|
||||
|
||||
if (!(xml = virCapabilitiesFormatXML(caps))) {
|
||||
virReportOOMError();
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
cleanup:
|
||||
virObjectUnref(caps);
|
||||
return xml;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user