From nobody Mon Feb 9 10:11:40 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=1569513086; cv=none; d=zoho.com; s=zohoarc; b=fWuNdxXyAG28B2vyw6rUyQdDSFGbvKNRN2HiYFq0mGH0PbF8tDdsw2HL/rChixbUFMH9XATHKjhA0xFlVLJ0Nd4wxahJCuhsjtWLWrGDfKPa/LSer/pUg6faSBNLob7VrJG0Ff9k0xEtsuqoE19reeu8i+XnpP/Bkho7+79vkSU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1569513086; 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=zXlxX5giUJbNpuBf0qBrYHP5Pq6ycTbCGwPTEB3AoY4=; b=SE5GsWvDzIVaq8Lrif/FZ0CtFyeY0OMh0bvANVKdJGokaSUHc+wZg5KxASpe9kt4P68NPg5XXPHSf2ZRpXc7ZQ07Hsgvk/1vvHap4Z1uP2TBUAh2HdvSIGslg32uVy6uEm/t7gO7zgxxeErWtLgeYSpMaRoczm9ZfGfn0HYEaUo= 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 1569513086468437.013417023794; Thu, 26 Sep 2019 08:51:26 -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 4C5938830B; Thu, 26 Sep 2019 15:51:24 +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 218CA1C941; Thu, 26 Sep 2019 15:51:24 +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 D10DF4EE6D; Thu, 26 Sep 2019 15:51:23 +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 x8QFpJ2e000770 for ; Thu, 26 Sep 2019 11:51:19 -0400 Received: by smtp.corp.redhat.com (Postfix) id CA1CE60C5D; Thu, 26 Sep 2019 15:51:19 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.229]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5216060C80 for ; Thu, 26 Sep 2019 15:51:18 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Thu, 26 Sep 2019 17:51:05 +0200 Message-Id: <60d2175032637d844ad163d1485981b24b96c588.1569512942.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 1/8] qemu: checkpoint: Refactor cleanup in qemuCheckpointCreateXML 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.28]); Thu, 26 Sep 2019 15:51:25 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Use VIR_AUTO* helpers and get rid of the 'cleanup' label. Signed-off-by: Peter Krempa --- src/qemu/qemu_checkpoint.c | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/src/qemu/qemu_checkpoint.c b/src/qemu/qemu_checkpoint.c index 30d1b6ae3a..4430f69911 100644 --- a/src/qemu/qemu_checkpoint.c +++ b/src/qemu/qemu_checkpoint.c @@ -363,9 +363,9 @@ qemuCheckpointCreateXML(virDomainPtr domain, bool redefine =3D flags & VIR_DOMAIN_CHECKPOINT_CREATE_REDEFINE; unsigned int parse_flags =3D 0; virDomainMomentObjPtr other =3D NULL; - virQEMUDriverConfigPtr cfg =3D NULL; - virCapsPtr caps =3D NULL; - virJSONValuePtr actions =3D NULL; + VIR_AUTOUNREF(virQEMUDriverConfigPtr) cfg =3D NULL; + VIR_AUTOUNREF(virCapsPtr) caps =3D NULL; + VIR_AUTOPTR(virJSONValue) actions =3D NULL; int ret; VIR_AUTOUNREF(virDomainCheckpointDefPtr) def =3D NULL; @@ -380,32 +380,32 @@ qemuCheckpointCreateXML(virDomainPtr domain, if (virDomainSnapshotObjListNum(vm->snapshots, NULL, 0) > 0) { virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s", _("cannot create checkpoint while snapshot exists")= ); - goto cleanup; + return NULL; } if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BITMAP_MERGE)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("qemu binary lacks persistent bitmaps support")); - goto cleanup; + return NULL; } if (!(caps =3D virQEMUDriverGetCapabilities(driver, false))) - goto cleanup; + return NULL; if (!virDomainObjIsActive(vm)) { virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s", _("cannot create checkpoint for inactive domain")); - goto cleanup; + return NULL; } if (!(def =3D virDomainCheckpointDefParseString(xmlDesc, caps, driver-= >xmlopt, priv->qemuCaps, parse_fl= ags))) - goto cleanup; + return NULL; /* Unlike snapshots, the RNG schema already ensured a sane filename. */ /* We are going to modify the domain below. */ if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MODIFY) < 0) - goto cleanup; + return NULL; if (redefine) { if (virDomainCheckpointRedefinePrep(vm, &def, &chk, @@ -484,10 +484,6 @@ qemuCheckpointCreateXML(virDomainPtr domain, qemuDomainObjEndJob(driver, vm); - cleanup: - virJSONValueFree(actions); - virObjectUnref(caps); - virObjectUnref(cfg); return checkpoint; } --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list