From nobody Sun Feb 8 05:54:54 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.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 153747932383998.89173042249172; Thu, 20 Sep 2018 14:35:23 -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 40EB481106; Thu, 20 Sep 2018 21:35:21 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id DFE3385A5D; Thu, 20 Sep 2018 21:35:20 +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 746A44BB75; Thu, 20 Sep 2018 21:35:20 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w8KLYi5W004505 for ; Thu, 20 Sep 2018 17:34:44 -0400 Received: by smtp.corp.redhat.com (Postfix) id 9545E3091385; Thu, 20 Sep 2018 21:34:44 +0000 (UTC) Received: from unknown54ee7586bd10.attlocal.net.com (ovpn-116-55.phx2.redhat.com [10.3.116.55]) by smtp.corp.redhat.com (Postfix) with ESMTP id 50784309137F for ; Thu, 20 Sep 2018 21:34:44 +0000 (UTC) From: John Ferlan To: libvir-list@redhat.com Date: Thu, 20 Sep 2018 17:34:36 -0400 Message-Id: <20180920213438.6412-2-jferlan@redhat.com> In-Reply-To: <20180920213438.6412-1-jferlan@redhat.com> References: <20180920213438.6412-1-jferlan@redhat.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.26 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 1/3] conf: Alter when ctxt->node is set 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.28]); Thu, 20 Sep 2018 21:35:22 +0000 (UTC) X-ZohoMail: RDMRC_0 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" In virDomainMemoryDefParseXML and virDomainVideoDefParseXML if the VIR_ALLOC fails and NULL is returned, then the alteration to ctxt->node isn't reversed. Found by Coverity Signed-off-by: John Ferlan --- src/conf/domain_conf.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 1ee43950ae..9911d56130 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -15089,11 +15089,11 @@ virDomainVideoDefParseXML(virDomainXMLOptionPtr x= mlopt, char *vgamem =3D NULL; char *primary =3D NULL; =20 - ctxt->node =3D node; - if (!(def =3D virDomainVideoDefNew())) return NULL; =20 + ctxt->node =3D node; + cur =3D node->children; while (cur !=3D NULL) { if (cur->type =3D=3D XML_ELEMENT_NODE) { @@ -15830,11 +15830,11 @@ virDomainMemoryDefParseXML(virDomainXMLOptionPtr = xmlopt, virDomainMemoryDefPtr def; int val; =20 - ctxt->node =3D memdevNode; - if (VIR_ALLOC(def) < 0) return NULL; =20 + ctxt->node =3D memdevNode; + if (!(tmp =3D virXMLPropString(memdevNode, "model"))) { virReportError(VIR_ERR_XML_ERROR, "%s", _("missing memory model")); --=20 2.17.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list