==24748== 12 bytes in 2 blocks are definitely lost in loss record 25 of 84 ==24748== at 0x4C2BF80: malloc (vg_replace_malloc.c:296) ==24748== by 0x1A1E1E78: xmlStrndup (in /usr/lib64/libxml2.so.2.9.4) ==24748== by 0x18D0495F: virXMLPropString (virxml.c:506) ==24748== by 0x18D1FB3E: virDomainHostdevSubsysSCSIVHostDefParseXML (domain_conf.c:6280) ==24748== by 0x18D20350: virDomainHostdevDefParseXMLSubsys (domain_conf.c:6450) ==24748== by 0x18D34E7D: virDomainHostdevDefParseXML (domain_conf.c:13218) ==24748== by 0x18D42598: virDomainDefParseXML (domain_conf.c:17745) ==24748== by 0x18D440A9: virDomainDefParseNode (domain_conf.c:18236) ==24748== by 0x18D43EFA: virDomainDefParse (domain_conf.c:18180) ==24748== by 0x18D43FA0: virDomainDefParseFile (domain_conf.c:18206) ==24748== by 0x44EDA1: testCompareDomXML2XMLFiles (testutils.c:1140) ==24748== by 0x4365F8: testXML2XMLActive (qemuxml2xmltest.c:59) Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx> --- src/conf/domain_conf.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 52aee2b02..55d2c25b2 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -6274,13 +6274,14 @@ static int virDomainHostdevSubsysSCSIVHostDefParseXML(xmlNodePtr sourcenode, virDomainHostdevDefPtr def) { - char *protocol = NULL; + char *protocol = NULL, *wwpn = NULL; virDomainHostdevSubsysSCSIVHostPtr hostsrc = &def->source.subsys.u.scsi_host; + int ret = -1; if (!(protocol = virXMLPropString(sourcenode, "protocol"))) { virReportError(VIR_ERR_XML_ERROR, "%s", _("Missing scsi_host subsystem protocol")); - return -1; + return ret; } if ((hostsrc->protocol = @@ -6293,17 +6294,19 @@ virDomainHostdevSubsysSCSIVHostDefParseXML(xmlNodePtr sourcenode, switch ((virDomainHostdevSubsysSCSIHostProtocolType) hostsrc->protocol) { case VIR_DOMAIN_HOSTDEV_SUBSYS_SCSI_HOST_PROTOCOL_TYPE_VHOST: - if (!(hostsrc->wwpn = virXMLPropString(sourcenode, "wwpn"))) { + if (!(wwpn = virXMLPropString(sourcenode, "wwpn"))) { virReportError(VIR_ERR_XML_ERROR, "%s", _("missing vhost-scsi hostdev source wwpn")); goto cleanup; } - if (!STRPREFIX(hostsrc->wwpn, "naa.") || - !virValidateWWN(hostsrc->wwpn + 4)) { + if (!STRPREFIX(wwpn, "naa.") || + !virValidateWWN(wwpn + 4)) { virReportError(VIR_ERR_XML_ERROR, "%s", _("malformed 'wwpn' value")); goto cleanup; } + hostsrc->wwpn = wwpn; + wwpn = NULL; break; case VIR_DOMAIN_HOSTDEV_SUBSYS_SCSI_HOST_PROTOCOL_TYPE_NONE: case VIR_DOMAIN_HOSTDEV_SUBSYS_SCSI_HOST_PROTOCOL_TYPE_LAST: @@ -6314,12 +6317,11 @@ virDomainHostdevSubsysSCSIVHostDefParseXML(xmlNodePtr sourcenode, break; } - return 0; - + ret = 0; cleanup: - VIR_FREE(hostsrc->wwpn); + VIR_FREE(wwpn); VIR_FREE(protocol); - return -1; + return ret; } -- 2.11.0 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list