From nobody Mon May 13 16:55:04 2024 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=1653303364; cv=none; d=zohomail.com; s=zohoarc; b=gryvwercl9NZz4dJTbTjoYbTGCprKZ0dQr/pUHWqYfkvmcLUnbLOg6eYouHSjV+ZjEGSQZ+HupKPn5FZWexnpkwnRneRIRkwcsbmLQHzBdiDjhy/3T0DCvEwNPSqmW0XaDxbTHM6RgC3kyw0MgyYrhFDi90usbe+0GH1SWonTts= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1653303364; h=Content-Type:Content-Transfer-Encoding:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=McmcJt7Ks9s30bd0yPXnUNdoVS7z0wEUrIoTFbDCo1U=; b=Y9WD1NTn+O/cvZNMGx4zrTpY6YNDQoi2stSU8caoOCnuuZvouV6FK4+Sv5rnqQypvIcyNn2fIK5nD97KkEWxQtHdvb4VpHyXEqDecdBLQSp3zCWgrnVx0dwB/ogB6vYZOsp5SqpyuHkmnc7TmVladckEMv2vd6x5ZkmIpuq026o= 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 1653303364805372.7822533148309; Mon, 23 May 2022 03:56:04 -0700 (PDT) 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-538-apPW5hBcNdWzqWO_AP55Fg-1; Mon, 23 May 2022 06:56:00 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 47E813C01D86; Mon, 23 May 2022 10:55:58 +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 D40152026D6A; Mon, 23 May 2022 10:55:57 +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 8B97E194705A; Mon, 23 May 2022 10:55:57 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 332061947059 for ; Mon, 23 May 2022 10:55:56 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 1B6321121319; Mon, 23 May 2022 10:55:56 +0000 (UTC) Received: from virval.usersys.redhat.com (unknown [10.43.2.187]) by smtp.corp.redhat.com (Postfix) with ESMTPS id EFEF71121314 for ; Mon, 23 May 2022 10:55:54 +0000 (UTC) Received: by virval.usersys.redhat.com (Postfix, from userid 500) id E6A832403FC; Mon, 23 May 2022 12:55:53 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1653303363; 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:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=McmcJt7Ks9s30bd0yPXnUNdoVS7z0wEUrIoTFbDCo1U=; b=ONB5fDVW9XITdm78olK5ZywY3HVEHMC9kc9fO55EOtUMsE9uFmg7Zd1STVhJysShfkmbxW Dgn/o1d/qdvC4aJGlLVMp3eyHQaLw7zzJ2ndXDLa/DP6z5vM7YRrFHjNJ1QyvpSil0kCc8 7/4U4Z2DO7+mX3mOgZFr4/Avrf0punI= X-MC-Unique: apPW5hBcNdWzqWO_AP55Fg-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Jiri Denemark To: libvir-list@redhat.com Subject: [libvirt PATCH] qemu: Fix error propagation in qemuMigrationBegin Date: Mon, 23 May 2022 12:55:17 +0200 Message-Id: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 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.78 on 10.11.54.4 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: 1653303366287100001 Content-Type: text/plain; charset="utf-8" Commit v8.3.0-152-g49ef0f95c6 removed explicit VIR_FREE from qemuMigrationBegin, effectively reverting v1.2.14-57-g77ddd0bba2 The xml variable was used to hold the return value and thus had to be unset when an error happened after xml was already non-NULL. Such code may be quite confusing though and we usually avoid it by not storing anything to a return variable until everything succeeded. Signed-off-by: Jiri Denemark Reviewed-by: Peter Krempa --- src/qemu/qemu_migration.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index 438f2bc999..38596fa4de 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -2487,6 +2487,7 @@ qemuMigrationSrcBegin(virConnectPtr conn, virQEMUDriver *driver =3D conn->privateData; g_autoptr(virQEMUDriverConfig) cfg =3D virQEMUDriverGetConfig(driver); g_autofree char *xml =3D NULL; + char *ret =3D NULL; virDomainAsyncJob asyncJob; =20 if (cfg->migrateTLSForce && @@ -2538,9 +2539,11 @@ qemuMigrationSrcBegin(virConnectPtr conn, goto endjob; } =20 + ret =3D g_steal_pointer(&xml); + cleanup: virDomainObjEndAPI(&vm); - return g_steal_pointer(&xml); + return ret; =20 endjob: if (flags & VIR_MIGRATE_CHANGE_PROTECTION) --=20 2.35.1