From nobody Sun Feb 8 22:58:16 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 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1551937737313215.79866149397094; Wed, 6 Mar 2019 21:48:57 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id AF0C687630; Thu, 7 Mar 2019 05:48:55 +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 7F3295D783; Thu, 7 Mar 2019 05:48:55 +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 3CAFC181A26C; Thu, 7 Mar 2019 05:48:55 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x275m7BC003930 for ; Thu, 7 Mar 2019 00:48:07 -0500 Received: by smtp.corp.redhat.com (Postfix) id D67725D788; Thu, 7 Mar 2019 05:48:07 +0000 (UTC) Received: from blue.redhat.com (ovpn-118-35.phx2.redhat.com [10.3.118.35]) by smtp.corp.redhat.com (Postfix) with ESMTP id D70975D786; Thu, 7 Mar 2019 05:48:06 +0000 (UTC) From: Eric Blake To: libvir-list@redhat.com Date: Wed, 6 Mar 2019 23:47:34 -0600 Message-Id: <20190307054752.19522-3-eblake@redhat.com> In-Reply-To: <20190307054752.19522-1-eblake@redhat.com> References: <20190307054752.19522-1-eblake@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Cc: amureini@redhat.com, derez@redhat.com, vsementsov@virtuozzo.com, zhanhouliang@outlook.com, bharadwaj.rayala@rubrik.com, ydary@redhat.com, nsoffer@redhat.com, jsnow@redhat.com, suman.swaroop@rubrik.com Subject: [libvirt] [PATCH v5 02/20] qemu: clean up qemuDomainRemoveInactiveCommon 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.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Thu, 07 Mar 2019 05:48:56 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Use VIR_AUTOFREE and saner formatting. No semantic change. Signed-off-by: Eric Blake Reviewed-by: John Ferlan --- src/qemu/qemu_domain.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 68298ad4e8..e243c07168 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -8652,8 +8652,8 @@ static void qemuDomainRemoveInactiveCommon(virQEMUDriverPtr driver, virDomainObjPtr vm) { - char *snapDir; virQEMUDriverConfigPtr cfg; + VIR_AUTOFREE(char *) snapDir =3D NULL; cfg =3D virQEMUDriverGetConfig(driver); @@ -8661,15 +8661,12 @@ qemuDomainRemoveInactiveCommon(virQEMUDriverPtr dri= ver, if (qemuDomainSnapshotDiscardAllMetadata(driver, vm) < 0) { VIR_WARN("unable to remove all snapshots for domain %s", vm->def->name); - } - else if (virAsprintf(&snapDir, "%s/%s", cfg->snapshotDir, - vm->def->name) < 0) { + } else if (virAsprintf(&snapDir, "%s/%s", cfg->snapshotDir, + vm->def->name) < 0) { VIR_WARN("unable to remove snapshot directory %s/%s", cfg->snapshotDir, vm->def->name); - } else { - if (rmdir(snapDir) < 0 && errno !=3D ENOENT) - VIR_WARN("unable to remove snapshot directory %s", snapDir); - VIR_FREE(snapDir); + } else if (rmdir(snapDir) < 0 && errno !=3D ENOENT) { + VIR_WARN("unable to remove snapshot directory %s", snapDir); } qemuExtDevicesCleanupHost(driver, vm->def); --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list