From nobody Mon Feb 9 10:57:22 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 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=1567611681; cv=none; d=zoho.com; s=zohoarc; b=XJAFZe1+mXJ7dQgbfeFUsC7idbjdHe1z9L/WDiKR1vI3HxlFj4dfkBP3Nnq+ToeUbn9rDGC0sNXbbRbrAZsfoSB+8WveOjDFctSDc3o1lgwSV9mqIOEiXK6LlbChaVkOWbURzjcVC9LLm7apw9u63YYNHOoHt7DwtIBWDXM3poo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1567611681; 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:ARC-Authentication-Results; bh=9MkSfKtDjLykh4rJMTGxLPUIvNdiFJHg6Ju2PqqYHPc=; b=btDfQWwrW0xziz7PhpFIJ1osETTii19jt5dnQrTTF2eQOADgytERWKzrSG+papl6RFL/JsR+b6dqKdrGU1KGdWhRFgN++TjD8FxU5IHRgDgAH0aN+c4R2/hPrVm7+5t3M/XQtac0O1yzazE0ZeVq5RSGZVHJcY8t/fY/k3OQUk4= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1567611681737464.86627071855855; Wed, 4 Sep 2019 08:41:21 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7FCF2308219F; Wed, 4 Sep 2019 15:41:19 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 55DC6809E; Wed, 4 Sep 2019 15:41:19 +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 1657A180221E; Wed, 4 Sep 2019 15:41:19 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x84FdXgT028816 for ; Wed, 4 Sep 2019 11:39:33 -0400 Received: by smtp.corp.redhat.com (Postfix) id 86FD760C57; Wed, 4 Sep 2019 15:39:33 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.229]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0FA5F60C18 for ; Wed, 4 Sep 2019 15:39:32 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Wed, 4 Sep 2019 17:39:26 +0200 Message-Id: <9b58e83060b25eddb0343a0154811efa917c9e5c.1567611460.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 2/4] qemu: migration: Refactor cleanup in qemuMigrationSrcNBDStorageCopyDriveMirror 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: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.47]); Wed, 04 Sep 2019 15:41:20 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Use VIR_AUTOFREE and remove the cleanup label. Signed-off-by: Peter Krempa --- src/qemu/qemu_migration.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index 1a557851bb..82625b2261 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -868,36 +868,31 @@ qemuMigrationSrcNBDStorageCopyDriveMirror(virQEMUDriv= erPtr driver, unsigned long long mirror_speed, bool mirror_shallow) { - char *nbd_dest =3D NULL; + VIR_AUTOFREE(char *) nbd_dest =3D NULL; int mon_ret; - int ret =3D -1; if (strchr(host, ':')) { if (virAsprintf(&nbd_dest, "nbd:[%s]:%d:exportname=3D%s", host, port, diskAlias) < 0) - goto cleanup; + return -1; } else { if (virAsprintf(&nbd_dest, "nbd:%s:%d:exportname=3D%s", host, port, diskAlias) < 0) - goto cleanup; + return -1; } if (qemuDomainObjEnterMonitorAsync(driver, vm, QEMU_ASYNC_JOB_MIGRATION_OUT) < 0) - goto cleanup; + return -1; mon_ret =3D qemuMonitorDriveMirror(qemuDomainGetMonitor(vm), diskAlias, nbd_dest, "raw", mirror_speed, 0, 0, mirror_shallow, t= rue); if (qemuDomainObjExitMonitor(driver, vm) < 0 || mon_ret < 0) - goto cleanup; - - ret =3D 0; + return -1; - cleanup: - VIR_FREE(nbd_dest); - return ret; + return 0; } --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list