From nobody Mon Feb 9 10:57:44 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.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.129.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=1646915223; cv=none; d=zohomail.com; s=zohoarc; b=dNMgKoak96PC1ibN3/2FBLe9HikpRKTPm/cOnfxozM2EQQGeX3Z4WkeK3ozzwJAf2H7JZbZgrCeHIX0pDZCPO73ZGgRDZrASI6MrewgBkArUAmGob3uhZagw6h0/nJDfjT75UvtOC9QLncUOJR2cFJeVRBRGdv+RXzyzRk6/S9M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1646915223; 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=7P7Yo8Zk6EythlyuOJu9oVuhlYgnl9dtfs4zVp/zcMo=; b=cIKWw18sHVJJoglmvBRbiqU5RUZG5OmHS0ExwuJOChQgmMQJ9U1So6Pm+/O4ZOR5AkBwWCPELFPIM12VZ/FOptVL7qg7qKbc6SEujLN+aGSqi63UheZYZ3IhidMWgj4W6+tGsWyyOAnUemUh31LO6nFSSsIDKvO60aBfePEsjVw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.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.129.124]) by mx.zohomail.com with SMTPS id 1646915223779689.6523019152943; Thu, 10 Mar 2022 04:27:03 -0800 (PST) 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-77-etRSBKi9NR-G9vEBieE5-A-1; Thu, 10 Mar 2022 07:26:10 -0500 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id DC3F1899EC4; Thu, 10 Mar 2022 12:26:08 +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 C8DBD463EB3; Thu, 10 Mar 2022 12:26:08 +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 7F640195FD5A; Thu, 10 Mar 2022 12:26:08 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id A94D9195356D for ; Thu, 10 Mar 2022 12:26:06 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 7A7301059A76; Thu, 10 Mar 2022 12:26:06 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.40.208.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id DFA361059A73 for ; Thu, 10 Mar 2022 12:26:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1646915222; 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=7P7Yo8Zk6EythlyuOJu9oVuhlYgnl9dtfs4zVp/zcMo=; b=isCbdGB6VDHKy03SpEUg17BVSDEHTMRAsPqO4MrTaoiZxY1SJ1yXvNQ8TVkPyqWWXaWZcc /y/z0ID2V2/sfLvqvTOxVwoDBwUvaefAWVh6jPjrcb/boXcPqgRtpuVfJE8mCtj1KVRVfL HVb7mG8MC4CUfRZwuQ5nx9AhlmX684o= X-MC-Unique: etRSBKi9NR-G9vEBieE5-A-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 09/10] qemuMigrationSrcNBDStorageCopyOne: Refactor cleanup Date: Thu, 10 Mar 2022 13:25:28 +0100 Message-Id: <41db0267a8d829b463c3e193482826f1d3353863.1646915027.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 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.10 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: 1646915226045100003 Content-Type: text/plain; charset="utf-8" Autofree the temporary string and shuffle around the success path to avoid the 'cleanup' label. Signed-off-by: Peter Krempa --- src/qemu/qemu_migration.c | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index 3650de3de8..69bcdafdf8 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -1035,7 +1035,7 @@ qemuMigrationSrcNBDStorageCopyOne(virQEMUDriver *driv= er, qemuDomainObjPrivate *priv =3D vm->privateData; qemuDomainDiskPrivate *diskPriv =3D QEMU_DOMAIN_DISK_PRIVATE(disk); qemuBlockJobData *job =3D NULL; - char *diskAlias =3D NULL; + g_autofree char *diskAlias =3D NULL; const char *jobname =3D NULL; const char *sourcename =3D NULL; bool persistjob =3D false; @@ -1044,10 +1044,10 @@ qemuMigrationSrcNBDStorageCopyOne(virQEMUDriver *dr= iver, int ret =3D -1; if (!(diskAlias =3D qemuAliasDiskDriveFromDisk(disk))) - goto cleanup; + return -1; if (!(job =3D qemuBlockJobDiskNew(vm, disk, QEMU_BLOCKJOB_TYPE_COPY, d= iskAlias))) - goto cleanup; + return -1; if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV)) { jobname =3D diskAlias; @@ -1079,17 +1079,13 @@ qemuMigrationSrcNBDStorageCopyOne(virQEMUDriver *dr= iver, mirror_shallow); } - if (rc < 0) - goto cleanup; - - diskPriv->migrating =3D true; - qemuBlockJobStarted(job, vm); - - ret =3D 0; + if (rc =3D=3D 0) { + diskPriv->migrating =3D true; + qemuBlockJobStarted(job, vm); + ret =3D 0; + } - cleanup: qemuBlockJobStartupFinalize(vm, job); - VIR_FREE(diskAlias); return ret; } --=20 2.35.1