From nobody Mon Feb 9 21:37:01 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=1646916064; cv=none; d=zohomail.com; s=zohoarc; b=av6zR2tBHDlwntlFswC1Tio2dqGzhb9CGqMYAskY+cqI7LRVA1WEr5liZGJ0+JfdtuOxDLVpg1hDNxJTiS+btU5cBJQlBAtqdfxUTq/BqfMYowAFE2fgSEkJUpugmgn6BK+Ll8xTSKNOU9W3/J0LXdFQHd/IJTX5Sd9BMEz9w3w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1646916064; 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=ikyg0hIpKsgRz/KvUwm8TrSIYQ3wQBRX5x9iQTjXGHw=; b=ilLL74lcS8I7TyTP3gea45hemes+WBMnOA7ErMvJMDlbAy0I1H0siTnMnOJJLz4HzboilZxLOw2lQxqBbvoeMvevdI+RZb0ckJtC6QOGJyFIXqm5hZJRZRV1eo2R/qQhY8fxkksrZTPTZ7xHy9Ztx5Wovxqd2oGVqnqVD/xc5VU= 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 1646916064253594.2399501109217; Thu, 10 Mar 2022 04:41:04 -0800 (PST) Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-596-nhlp1fubPhSMyXmeKw9APA-1; Thu, 10 Mar 2022 07:41:02 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 288982A2AD40; Thu, 10 Mar 2022 12:41:00 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 136BA141DC5F; Thu, 10 Mar 2022 12:41:00 +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 B2D3D1953576; Thu, 10 Mar 2022 12:40:59 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id EA5C71953573 for ; Thu, 10 Mar 2022 12:40:57 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id AC9F77B6DF; Thu, 10 Mar 2022 12:40:57 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.40.208.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id 112367B6D8 for ; Thu, 10 Mar 2022 12:40:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1646916064; 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=ikyg0hIpKsgRz/KvUwm8TrSIYQ3wQBRX5x9iQTjXGHw=; b=ea199HDQPNJmyVPLT2WC2WluyAlih10bk/rTINEIytXherCPLY2vhXAl+Zuhl9HkWMRHSW YcVWcd6MhTrMoLkg8W3m+4379r+aYrO1ME5DzCCWLwteqkW+zElY3vOFMKNW8mUok4p/Pg MTRKwROWVXgjZeFzX30XIDo607dzKXQ= X-MC-Unique: nhlp1fubPhSMyXmeKw9APA-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 11/14] virDomainSnapshotDefParse: Avoid 'memoryfile' temporary variable Date: Thu, 10 Mar 2022 13:40:39 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 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 2.85 on 10.11.54.7 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: 1646916081381100001 Content-Type: text/plain; charset="utf-8" Assign directly into the definition. The cleanup code can deal with that. Signed-off-by: Peter Krempa --- src/conf/snapshot_conf.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/conf/snapshot_conf.c b/src/conf/snapshot_conf.c index f3b264d2e1..7f98ae6aec 100644 --- a/src/conf/snapshot_conf.c +++ b/src/conf/snapshot_conf.c @@ -221,7 +221,6 @@ virDomainSnapshotDefParse(xmlXPathContextPtr ctxt, size_t i; int n; g_autofree char *memorySnapshot =3D NULL; - g_autofree char *memoryFile =3D NULL; bool offline =3D !!(flags & VIR_DOMAIN_SNAPSHOT_PARSE_OFFLINE); virSaveCookieCallbacks *saveCookie =3D virDomainXMLOptionGetSaveCookie= (xmlopt); int domainflags =3D VIR_DOMAIN_DEF_PARSE_INACTIVE | @@ -309,7 +308,7 @@ virDomainSnapshotDefParse(xmlXPathContextPtr ctxt, } memorySnapshot =3D virXPathString("string(./memory/@snapshot)", ctxt); - memoryFile =3D virXPathString("string(./memory/@file)", ctxt); + def->memorysnapshotfile =3D virXPathString("string(./memory/@file)", c= txt); if (memorySnapshot) { def->memory =3D virDomainSnapshotLocationTypeFromString(memorySnap= shot); if (def->memory <=3D 0) { @@ -318,20 +317,20 @@ virDomainSnapshotDefParse(xmlXPathContextPtr ctxt, memorySnapshot); return NULL; } - if (memoryFile && + if (def->memorysnapshotfile && def->memory !=3D VIR_DOMAIN_SNAPSHOT_LOCATION_EXTERNAL) { virReportError(VIR_ERR_XML_ERROR, _("memory filename '%s' requires external snaps= hot"), - memoryFile); + def->memorysnapshotfile); return NULL; } - if (!memoryFile && + if (!def->memorysnapshotfile && def->memory =3D=3D VIR_DOMAIN_SNAPSHOT_LOCATION_EXTERNAL) { virReportError(VIR_ERR_XML_ERROR, "%s", _("external memory snapshots require a filename= ")); return NULL; } - } else if (memoryFile) { + } else if (def->memorysnapshotfile) { def->memory =3D VIR_DOMAIN_SNAPSHOT_LOCATION_EXTERNAL; } else if (flags & VIR_DOMAIN_SNAPSHOT_PARSE_REDEFINE) { def->memory =3D (offline ? @@ -345,7 +344,6 @@ virDomainSnapshotDefParse(xmlXPathContextPtr ctxt, "disk-only snapshot")); return NULL; } - def->memorysnapshotfile =3D g_steal_pointer(&memoryFile); /* verify that memory path is absolute */ if (def->memorysnapshotfile && !g_path_is_absolute(def->memorysnapshot= file)) { --=20 2.35.1