From nobody Wed Feb 11 06:13:09 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1493377886772838.7540075452376; Fri, 28 Apr 2017 04:11:26 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E6B6867ECB; Fri, 28 Apr 2017 11:11:24 +0000 (UTC) Received: from colo-mx.corp.redhat.com (unknown [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C1E258B32C; Fri, 28 Apr 2017 11:11:24 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 7138F5ED66; Fri, 28 Apr 2017 11:11:24 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v3SBAXMu004438 for ; Fri, 28 Apr 2017 07:10:33 -0400 Received: by smtp.corp.redhat.com (Postfix) id 734DD9533A; Fri, 28 Apr 2017 11:10:33 +0000 (UTC) Received: from angien.brq.redhat.com (dhcp129-47.brq.redhat.com [10.34.129.47]) by smtp.corp.redhat.com (Postfix) with ESMTP id C9E5378352; Fri, 28 Apr 2017 11:10:32 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com E6B6867ECB Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=libvir-list-bounces@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com E6B6867ECB From: Peter Krempa To: libvir-list@redhat.com Date: Fri, 28 Apr 2017 13:10:25 +0200 Message-Id: <7c4a6a410b076b1d8b5d4be850282c565dc5f446.1493377776.git.pkrempa@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Cc: Peter Krempa Subject: [libvirt] [PATCH v2 2/4] conf: Use only one temporary string in virDomainDiskSourceParse X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Fri, 28 Apr 2017 11:11:25 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" --- src/conf/domain_conf.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 5a736c853..c40a5a7a6 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -7526,7 +7526,7 @@ virDomainDiskSourceParse(xmlNodePtr node, virStorageSourcePtr src) { int ret =3D -1; - char *protocol =3D NULL; + char *tmp =3D NULL; xmlNodePtr saveNode =3D ctxt->node; ctxt->node =3D node; @@ -7542,17 +7542,18 @@ virDomainDiskSourceParse(xmlNodePtr node, src->path =3D virXMLPropString(node, "dir"); break; case VIR_STORAGE_TYPE_NETWORK: - if (!(protocol =3D virXMLPropString(node, "protocol"))) { + if (!(tmp =3D virXMLPropString(node, "protocol"))) { virReportError(VIR_ERR_XML_ERROR, "%s", _("missing network source protocol type")); goto cleanup; } - if ((src->protocol =3D virStorageNetProtocolTypeFromString(protoco= l)) <=3D 0) { + if ((src->protocol =3D virStorageNetProtocolTypeFromString(tmp)) <= =3D 0) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("unknown protocol type '%s'"), protocol); + _("unknown protocol type '%s'"), tmp); goto cleanup; } + VIR_FREE(tmp); if (!(src->path =3D virXMLPropString(node, "name")) && src->protocol !=3D VIR_STORAGE_NET_PROTOCOL_NBD) { @@ -7565,7 +7566,6 @@ virDomainDiskSourceParse(xmlNodePtr node, * as a part of the path. This is hard to work with when dealing w= ith * relative names. Split out the volume into a separate variable */ if (src->path && src->protocol =3D=3D VIR_STORAGE_NET_PROTOCOL_GLU= STER) { - char *tmp; if (!(tmp =3D strchr(src->path, '/')) || tmp =3D=3D src->path) { virReportError(VIR_ERR_XML_ERROR, @@ -7580,6 +7580,7 @@ virDomainDiskSourceParse(xmlNodePtr node, goto cleanup; tmp[0] =3D '\0'; + tmp =3D NULL; } /* snapshot currently works only for remote disks */ @@ -7612,7 +7613,7 @@ virDomainDiskSourceParse(xmlNodePtr node, ret =3D 0; cleanup: - VIR_FREE(protocol); + VIR_FREE(tmp); ctxt->node =3D saveNode; return ret; } --=20 2.12.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list