Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-15-SP1:GA
libvirt.9813
4817687a-rework-virDomainSEVDefParseXML.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 4817687a-rework-virDomainSEVDefParseXML.patch of Package libvirt.9813
commit 4817687a7de39b0296894f0d8d3959754d60fd30 Author: Michal Privoznik <mprivozn@redhat.com> Date: Wed Jun 13 12:44:06 2018 +0200 conf: Rework virDomainSEVDefParseXML() Firstly, this function changes node for relative XPaths but doesn't restore the original one in case VIR_ALLOC(def) fails. Secondly, @type is leaked. Thirdly, dh-cert and session attributes are strdup()-ed needlessly, virXPathString already does that so we can use the retval immediately. Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com> Index: libvirt-4.0.0/src/conf/domain_conf.c =================================================================== --- libvirt-4.0.0.orig/src/conf/domain_conf.c +++ libvirt-4.0.0/src/conf/domain_conf.c @@ -15432,17 +15432,16 @@ static virDomainSEVDefPtr virDomainSEVDefParseXML(xmlNodePtr sevNode, xmlXPathContextPtr ctxt) { - char *tmp = NULL; char *type = NULL; xmlNodePtr save = ctxt->node; virDomainSEVDefPtr def; unsigned long policy; - ctxt->node = sevNode; - if (VIR_ALLOC(def) < 0) return NULL; + ctxt->node = sevNode; + if (!(type = virXMLPropString(sevNode, "type"))) { virReportError(VIR_ERR_XML_ERROR, "%s", _("missing launch security type")); @@ -15482,29 +15481,18 @@ virDomainSEVDefParseXML(xmlNodePtr sevNo } def->policy = policy; + def->dh_cert = virXPathString("string(./dhCert)", ctxt); + def->session = virXPathString("string(./session)", ctxt); - if ((tmp = virXPathString("string(./dhCert)", ctxt))) { - if (VIR_STRDUP(def->dh_cert, tmp) < 0) - goto error; - - VIR_FREE(tmp); - } - - if ((tmp = virXPathString("string(./session)", ctxt))) { - if (VIR_STRDUP(def->session, tmp) < 0) - goto error; - - VIR_FREE(tmp); - } - + cleanup: + VIR_FREE(type); ctxt->node = save; return def; error: - VIR_FREE(tmp); virDomainSEVDefFree(def); - ctxt->node = save; - return NULL; + def = NULL; + goto cleanup; } static virDomainMemoryDefPtr
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor