From nobody Sun Feb 8 17:42:21 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1637601175; cv=none; d=zohomail.com; s=zohoarc; b=lIUMSBj1jonLmH+ciyZIHQvEvOfSlr7mgfxqbaOHsBvwfrAi1cCdgj/9E7dCLCXY+HE0kOweP2TOcQUJ1xw6vy9IQFIWy+ajX/N6BuzFIV5+Qlv9SfhY28SCA6/7a3IyzWi89HvcEf9rQQHLoR29iwYnc1+yD3dSjO5F1Vw4WkI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1637601175; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=k1W8k+UvxCqKRiEVOiIxteaYy8ckBMF4kcQNtqZZsK8=; b=iGWswuwLuZ1Szw3Kf8nm1JrWTg9Xwt9HYHzJu2yE/Eh65bsO/yQeyd1DlBMWSWrJ0s+YgN6Q9p1uWmuqqfsaN5WINoeojBsbJ+yr5HyaFK0hpPexCFZsdLaLNmJPZN5yIoDQEvNyXImmFimabT77RXnvGwnMqhIgeNY2QNmJQnE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1637601175655513.2545665660095; Mon, 22 Nov 2021 09:12:55 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-563-4bARlEtpP1WCl1DiJS7nUg-1; Mon, 22 Nov 2021 12:12:52 -0500 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 7410D10823D8; Mon, 22 Nov 2021 17:12:42 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 198BE5F93C; Mon, 22 Nov 2021 17:12:42 +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 09A661832E85; Mon, 22 Nov 2021 17:12:41 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1AMHCe3p029303 for ; Mon, 22 Nov 2021 12:12:40 -0500 Received: by smtp.corp.redhat.com (Postfix) id ED92860C82; Mon, 22 Nov 2021 17:12:39 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id 42CE05FCB3 for ; Mon, 22 Nov 2021 17:12:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1637601174; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=k1W8k+UvxCqKRiEVOiIxteaYy8ckBMF4kcQNtqZZsK8=; b=KjWeG5rsoRa5IYchIR3U+kOj03hXtf8guM/jxa22fN46Nm3Hsc1CGQTG9uif3L7d+ZDuJI 84jA98AAeBj+RM9d/YXNZJ+EiGDjB8XABHVuQqHjKtlaprP0x6u+XcmprHMPE4O/W0R8zb RDz2bvhlidHbVLqJ/KKvk8nG+4HJyj8= X-MC-Unique: 4bARlEtpP1WCl1DiJS7nUg-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 03/12] virSecurityLabelDefParseXML: Directly assign strings into appropriate variables Date: Mon, 22 Nov 2021 18:12:23 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1637601177568100001 Content-Type: text/plain; charset="utf-8" 'seclabel->label', 'seclabel->imagelabel' and 'seclabel->baselabel' are populated by stealing the pointer from the 'p' temporary string. Remove the extra step. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/conf/domain_conf.c | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index ba38d510dd..24de57005c 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -7874,36 +7874,32 @@ virSecurityLabelDefParseXML(xmlXPathContextPtr ctxt, if (seclabel->type =3D=3D VIR_DOMAIN_SECLABEL_STATIC || (!(flags & VIR_DOMAIN_DEF_PARSE_INACTIVE) && seclabel->type !=3D VIR_DOMAIN_SECLABEL_NONE)) { - p =3D virXPathStringLimit("string(./label[1])", - VIR_SECURITY_LABEL_BUFLEN-1, ctxt); - if (p =3D=3D NULL) { + seclabel->label =3D virXPathStringLimit("string(./label[1])", + VIR_SECURITY_LABEL_BUFLEN-1,= ctxt); + if (!seclabel->label) { virReportError(VIR_ERR_XML_ERROR, "%s", _("security label is missing")); goto error; } - - seclabel->label =3D g_steal_pointer(&p); } /* Only parse imagelabel, if requested live XML with relabeling */ if (seclabel->relabel && (!(flags & VIR_DOMAIN_DEF_PARSE_INACTIVE) && seclabel->type !=3D VIR_DOMAIN_SECLABEL_NONE)) { - p =3D virXPathStringLimit("string(./imagelabel[1])", - VIR_SECURITY_LABEL_BUFLEN-1, ctxt); - if (p =3D=3D NULL) { + seclabel->imagelabel =3D virXPathStringLimit("string(./imagelabel[= 1])", + VIR_SECURITY_LABEL_BUFL= EN-1, ctxt); + if (!seclabel->imagelabel) { virReportError(VIR_ERR_XML_ERROR, "%s", _("security imagelabel is missing")); goto error; } - seclabel->imagelabel =3D g_steal_pointer(&p); } /* Only parse baselabel for dynamic label type */ if (seclabel->type =3D=3D VIR_DOMAIN_SECLABEL_DYNAMIC) { - p =3D virXPathStringLimit("string(./baselabel[1])", - VIR_SECURITY_LABEL_BUFLEN-1, ctxt); - seclabel->baselabel =3D g_steal_pointer(&p); + seclabel->baselabel =3D virXPathStringLimit("string(./baselabel[1]= )", + VIR_SECURITY_LABEL_BUFLE= N-1, ctxt); } return seclabel; --=20 2.31.1