From nobody Sun Feb 8 14:56:58 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.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 63.128.21.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=1613656566; cv=none; d=zohomail.com; s=zohoarc; b=HvkMtxorkPlXn3Tew49hANz2eS+iAYne2XAkk75jZPzj97JPdFtQAUkUPP+STJUL4WdYmB6mq3kRNI2PKovSKGR0Qj003eLsYDU7jv0QpCpaLi6lvbcm0Oh1Rv3yhc8hF9YRSBBtfPuCAbSurmQDt2M6jAhrJLW169XaGiZTabI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1613656566; 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=1boRhIJ3wWwVnakGuz5pYzh475g1ZVNmG4k+JPqlMIo=; b=MsPqrMbLAQRuC79+YKhE8e2PUGJFZ034ezAQDB0IZODoY2gFkVHV2ixot2bQPr5Dcoqn1tauZLDj5+sq3cgXq1ykGNCxVHGKftz1xtfcoERx1ZDfzjoiD6suk8cOKWE4UPK0DAQFp5Lp2wbOXegdkPeA19OUiLX/lJ0l9JyWe5M= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 161365656554127.192776645128106; Thu, 18 Feb 2021 05:56:05 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-450-4uAmBDx2NR-w1hmoS1PCDg-1; Thu, 18 Feb 2021 08:56:01 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 72854EC1A6; Thu, 18 Feb 2021 13:55:54 +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 5039460C6B; Thu, 18 Feb 2021 13:55:54 +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 162334EEF6; Thu, 18 Feb 2021 13:55:54 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 11IDtbYA026289 for ; Thu, 18 Feb 2021 08:55:37 -0500 Received: by smtp.corp.redhat.com (Postfix) id 9A3BD5B4B0; Thu, 18 Feb 2021 13:55:37 +0000 (UTC) Received: from hjs.redhat.com (unknown [10.43.2.12]) by smtp.corp.redhat.com (Postfix) with ESMTP id 239756F7E6 for ; Thu, 18 Feb 2021 13:55:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1613656564; 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=1boRhIJ3wWwVnakGuz5pYzh475g1ZVNmG4k+JPqlMIo=; b=eQ/xEUWgHuhENGiP78FCO4X20jN47ZtXAYRkSRI2f7GIKLqbksIvOWA5Jb2SODeX1/nnEI yiQ6YUv21b4WD1lgvGHegWMZ23L7saLwrVwB1yING16lFa5R6WQB6jFczZWWD1BvZK0v43 1f/NmQAiYvy4Kj5JZctvKld2Lr+Y+IQ= X-MC-Unique: 4uAmBDx2NR-w1hmoS1PCDg-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH 2/4] qemu: saveimage: only steal domXML on success Date: Thu, 18 Feb 2021 14:55:27 +0100 Message-Id: <074584849ad7fa2505ac14c3ef5847c83ea53d02.1613656486.git.jtomko@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 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.12 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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) The comment and the caller assume virQEMUSaveDataNew only steals domXML on success, but it is copied even on failure. Also remove the misleading g_steal_pointer call on a local variable. Reported by coverity. Signed-off-by: J=C3=A1n Tomko --- src/qemu/qemu_saveimage.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/qemu/qemu_saveimage.c b/src/qemu/qemu_saveimage.c index de2d63dd9a..5d542bf977 100644 --- a/src/qemu/qemu_saveimage.c +++ b/src/qemu/qemu_saveimage.c @@ -105,8 +105,6 @@ virQEMUSaveDataNew(char *domXML, =20 data =3D g_new0(virQEMUSaveData, 1); =20 - data->xml =3D g_steal_pointer(&domXML); - if (cookieObj && !(data->cookie =3D virSaveCookieFormat((virObjectPtr) cookieObj, virDomainXMLOptionGetSaveCook= ie(xmlopt)))) @@ -118,6 +116,7 @@ virQEMUSaveDataNew(char *domXML, header->was_running =3D running ? 1 : 0; header->compressed =3D compressed; =20 + data->xml =3D domXML; return data; =20 error: --=20 2.26.2