From nobody Mon Feb 9 21:36:53 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=1571412632; cv=none; d=zoho.com; s=zohoarc; b=FJVyW+ReGQSxrIry67BQbU+OeWJr4Z47BFNanDFa+CEPs2fwyi7StTWOO7l2j1GDMkLW2b95iElS/fxhmX27+7MhyGKXgutXta2i5KeAamWwXP9j6l2kfZP5vloVvmLrzXgeuahXHQE5reXA1G3uU960f9Gstj1ZVmMJmjlbaXU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571412632; h=Content-Type:Content-Transfer-Encoding:Cc: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=sPLSX2aHZOsIUewCpHbzdiRTKYfaMEbmWeJvi4ijYi8=; b=VT7uYsQtwiyxHjF7mBGEn713traRlXXcsfk+n0rX1d99yua5SyYiUVbzjzcrs/+xkY1pikQ46TmAdhWlu5WfXrepJPI66a4pMUKEo2fDR4BEUpbxvyySiXgX2ejxCJtS28Wpl2IsKHyAo5ks7NJZGzr7qXnYUU3pEQYu6TsIueM= 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 1571412632018585.6721436493553; Fri, 18 Oct 2019 08:30:32 -0700 (PDT) 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 19CB518C4288; Fri, 18 Oct 2019 15:30:30 +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 D6E8E5D70E; Fri, 18 Oct 2019 15:30:29 +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 826AE4EE6A; Fri, 18 Oct 2019 15:30:29 +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 x9IFULWg001368 for ; Fri, 18 Oct 2019 11:30:21 -0400 Received: by smtp.corp.redhat.com (Postfix) id A83735D721; Fri, 18 Oct 2019 15:30:21 +0000 (UTC) Received: from himantopus.redhat.com (ovpn-116-193.phx2.redhat.com [10.3.116.193]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6C74D5B6A5; Fri, 18 Oct 2019 15:30:21 +0000 (UTC) From: Jonathon Jongsma To: libvir-list@redhat.com Date: Fri, 18 Oct 2019 10:30:10 -0500 Message-Id: <20191018153017.4819-3-jjongsma@redhat.com> In-Reply-To: <20191018153017.4819-1-jjongsma@redhat.com> References: <20191018153017.4819-1-jjongsma@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Cc: crobinso@redhat.com Subject: [libvirt] [PATCH v3 2/9] qemu: use g_autoptr in qemuDomainDeviceDefValidate() 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.6.2 (mx1.redhat.com [10.5.110.62]); Fri, 18 Oct 2019 15:30:30 +0000 (UTC) Content-Type: text/plain; charset="utf-8" This allows us to simplify the function and avoid jumping to 'cleanup'. Signed-off-by: Jonathon Jongsma --- 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 92a0df2d75..39ab424873 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -7195,8 +7195,8 @@ qemuDomainDeviceDefValidate(const virDomainDeviceDef = *dev, { int ret =3D 0; virQEMUDriverPtr driver =3D opaque; - virQEMUCapsPtr qemuCaps =3D NULL; - virDomainCapsPtr domCaps =3D NULL; + g_autoptr(virQEMUCaps) qemuCaps =3D NULL; + g_autoptr(virDomainCaps) domCaps =3D NULL; =20 if (!(qemuCaps =3D virQEMUCapsCacheLookup(driver->qemuCapsCache, def->emulator))) @@ -7206,13 +7206,13 @@ qemuDomainDeviceDefValidate(const virDomainDeviceDe= f *dev, def->os.machine, def->os.arch, def->virtType))) - goto cleanup; + return -1; =20 if ((ret =3D qemuDomainDeviceDefValidateAddress(dev, qemuCaps)) < 0) - goto cleanup; + return ret; =20 if ((ret =3D virDomainCapsDeviceDefValidate(domCaps, dev, def)) < 0) - goto cleanup; + return ret; =20 switch ((virDomainDeviceType)dev->type) { case VIR_DOMAIN_DEVICE_NET: @@ -7298,9 +7298,6 @@ qemuDomainDeviceDefValidate(const virDomainDeviceDef = *dev, break; } =20 - cleanup: - virObjectUnref(qemuCaps); - virObjectUnref(domCaps); return ret; } =20 --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list