mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
domain_conf: Resolve Coverity RESOURCE_LEAK
Resolve a few RESOURCE_LEAK's identified by Coverity
This commit is contained in:
parent
4f25146bf4
commit
f9c827e383
@ -5654,7 +5654,8 @@ virDomainDiskDefParseXML(virDomainXMLOptionPtr xmlopt,
|
|||||||
}
|
}
|
||||||
VIR_FREE(ready);
|
VIR_FREE(ready);
|
||||||
}
|
}
|
||||||
} else if (xmlStrEqual(cur->name, BAD_CAST "auth")) {
|
} else if (!authdef &&
|
||||||
|
xmlStrEqual(cur->name, BAD_CAST "auth")) {
|
||||||
if (!(authdef = virStorageAuthDefParse(node->doc, cur)))
|
if (!(authdef = virStorageAuthDefParse(node->doc, cur)))
|
||||||
goto error;
|
goto error;
|
||||||
if ((auth_secret_usage =
|
if ((auth_secret_usage =
|
||||||
@ -12065,20 +12066,22 @@ virDomainDefParseXML(xmlDocPtr xml,
|
|||||||
vcpupin->vcpuid)) {
|
vcpupin->vcpuid)) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
"%s", _("duplicate vcpupin for same vcpu"));
|
"%s", _("duplicate vcpupin for same vcpu"));
|
||||||
VIR_FREE(vcpupin);
|
virDomainVcpuPinDefFree(vcpupin);
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (vcpupin->vcpuid >= def->vcpus)
|
if (vcpupin->vcpuid >= def->vcpus) {
|
||||||
/* To avoid the regression when daemon loading
|
/* To avoid the regression when daemon loading
|
||||||
* domain confs, we can't simply error out if
|
* domain confs, we can't simply error out if
|
||||||
* <vcpupin> nodes greater than current vcpus,
|
* <vcpupin> nodes greater than current vcpus,
|
||||||
* ignoring them instead.
|
* ignoring them instead.
|
||||||
*/
|
*/
|
||||||
VIR_WARN("Ignore vcpupin for not onlined vcpus");
|
VIR_WARN("Ignore vcpupin for not onlined vcpus");
|
||||||
else
|
virDomainVcpuPinDefFree(vcpupin);
|
||||||
|
} else {
|
||||||
def->cputune.vcpupin[def->cputune.nvcpupin++] = vcpupin;
|
def->cputune.vcpupin[def->cputune.nvcpupin++] = vcpupin;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
VIR_FREE(nodes);
|
VIR_FREE(nodes);
|
||||||
|
|
||||||
/* Initialize the pinning policy for vcpus which doesn't has
|
/* Initialize the pinning policy for vcpus which doesn't has
|
||||||
@ -13127,6 +13130,7 @@ virDomainDefParseXML(xmlDocPtr xml,
|
|||||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||||
_("Can't add host USB device: "
|
_("Can't add host USB device: "
|
||||||
"USB is disabled in this host"));
|
"USB is disabled in this host"));
|
||||||
|
virDomainHostdevDefFree(hostdev);
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -13266,6 +13270,7 @@ virDomainDefParseXML(xmlDocPtr xml,
|
|||||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||||
_("Can't add redirected USB device: "
|
_("Can't add redirected USB device: "
|
||||||
"USB is disabled for this domain"));
|
"USB is disabled for this domain"));
|
||||||
|
virDomainRedirdevDefFree(redirdev);
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -15127,8 +15132,10 @@ virDomainEmulatorPinAdd(virDomainDefPtr def,
|
|||||||
|
|
||||||
emulatorpin->vcpuid = -1;
|
emulatorpin->vcpuid = -1;
|
||||||
emulatorpin->cpumask = virBitmapNewData(cpumap, maplen);
|
emulatorpin->cpumask = virBitmapNewData(cpumap, maplen);
|
||||||
if (!emulatorpin->cpumask)
|
if (!emulatorpin->cpumask) {
|
||||||
|
virDomainVcpuPinDefFree(emulatorpin);
|
||||||
return -1;
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
def->cputune.emulatorpin = emulatorpin;
|
def->cputune.emulatorpin = emulatorpin;
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user