From nobody Sun Feb 8 21:48:04 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.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 170.10.133.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=1663577738; cv=none; d=zohomail.com; s=zohoarc; b=Lxwo+BE5srJBSvTFiA415DxJdt33rBdTMMQ57V2/XThnbyZlNK+gOhpF81Bt0K+8JHJcPtjayQZuN+rLOpSvkjaIcIV4uxGsDCgvllsIZ3MwDZUI0TTc4s5hGvfUywYQ1/D9A4w/fx3V/nXnAjTj3YLGjd8wLb0rLONXzIuhEXg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1663577738; 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=Nd0wQT+Ma9jI0Nt/n0N7nvbU3BeKjFqNSwovz7Q5EVI=; b=XaUtWTT7+6BnuitFLATNGSHWtaoK7iVBvgr/3hfjLtM2YhicsWJSwRN8MCuFnLIu2cdooqdA+BkxrY11tmbLWuxmfwOPNAJWhdAwQBg3PBZVeq5uFaKOqZnvA9OXYLfYub3V9D+A3vfhF15/3s8CO2IGTFlYsn33brSVFCe1xEc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.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 [170.10.133.124]) by mx.zohomail.com with SMTPS id 1663577738899452.39468113529733; Mon, 19 Sep 2022 01:55:38 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-146-pkqp5jdxM5Ox2C6Watd7Iw-1; Mon, 19 Sep 2022 04:55:34 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 9A48F185A7A4; Mon, 19 Sep 2022 08:55:32 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 88A111121314; Mon, 19 Sep 2022 08:55:32 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 6DC421946594; Mon, 19 Sep 2022 08:55:32 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 41AE01946A42 for ; Mon, 19 Sep 2022 08:55:31 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 303E240C6EC4; Mon, 19 Sep 2022 08:55:31 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9C2C340C6EC2 for ; Mon, 19 Sep 2022 08:55:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1663577737; 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=Nd0wQT+Ma9jI0Nt/n0N7nvbU3BeKjFqNSwovz7Q5EVI=; b=YvQHea8davst4rAQ94Zw9baFIMTNdr4jiH+bw9iEjlSkmbG/pLMvqsigYRG2fK2xidzt1e o6bivtXAtW1tGHqHF6orZBkCZmrvor3ztNloelR4DZmTyInyg9J5qXotu6x1NOWnWwv6O6 XksMulPyyULzcL+jrbR/7BPZJdGznwc= X-MC-Unique: pkqp5jdxM5Ox2C6Watd7Iw-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 08/37] virDomainNetIPInfoParseXML: Remove pointless automatic clearing of 'route' and 'ip' Date: Mon, 19 Sep 2022 10:54:53 +0200 Message-Id: <11cdca1917b7ac9b2e13f86583d1dcc9b2c64709.1663577577.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 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: 1663577739030100010 Content-Type: text/plain; charset="utf-8" The variables are only used in code paths which can't fail after they are allocated. Additionally decrease scope of the variables. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/conf/domain_conf.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 745a7e428c..5c91cbd0db 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -6216,17 +6216,17 @@ virDomainNetIPInfoParseXML(const char *source, xmlXPathContextPtr ctxt, virNetDevIPInfo *def) { - g_autoptr(virNetDevIPRoute) route =3D NULL; int nnodes; int ret =3D -1; size_t i; g_autofree xmlNodePtr *nodes =3D NULL; - g_autofree virNetDevIPAddr *ip =3D NULL; if ((nnodes =3D virXPathNodeSet("./ip", ctxt, &nodes)) < 0) goto cleanup; for (i =3D 0; i < nnodes; i++) { + virNetDevIPAddr *ip =3D NULL; + if (!(ip =3D virDomainNetIPParseXML(nodes[i]))) goto cleanup; @@ -6238,6 +6238,8 @@ virDomainNetIPInfoParseXML(const char *source, goto cleanup; for (i =3D 0; i < nnodes; i++) { + virNetDevIPRoute *route =3D NULL; + if (!(route =3D virNetDevIPRouteParseXML(source, nodes[i], ctxt))) goto cleanup; --=20 2.37.1