From nobody Mon Feb 9 19:52:07 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=1570829285; cv=none; d=zoho.com; s=zohoarc; b=nMI/c2t4MhYh1pk1eIrcolsswFKQfeCHKME9NZJC4hfLQlm47E/LHa+NMH0g3rj8Y7kMl4wwAXlISAEffqncqehUsld2S8P6Kj8r2tTsbaTrMR6+Wnj8y08CIlZCcDrqVOelONgTQEL5VEYEcSgZkWayoEFBwEfyyqFWvutNSpM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1570829285; 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=vFXiMgJFHy2D5jW/POpgy8bsBCazit46xXs5gtoMj78=; b=eK9QhmkQbaN5tqHfORIRE2VFdRNVHxd1AYN97MVj82fJM6cTd33oBomBHkv+qS5KJCq9j/D9IUPOIcsym6TICJ6K/kUcIvx1sQzD66LDTQgahKrj6an/tJKjxltmEmj/OWfBOMEDiIcEB4GqPo78TwqnNcH0LMHrPtiWMPDsrn8= 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 1570829285479867.2293530314915; Fri, 11 Oct 2019 14:28:05 -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 E38F410CC20B; Fri, 11 Oct 2019 21:28:02 +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 B6F715D713; Fri, 11 Oct 2019 21:28:02 +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 6ED8A83738; Fri, 11 Oct 2019 21:28:02 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x9BLRwai007285 for ; Fri, 11 Oct 2019 17:27:58 -0400 Received: by smtp.corp.redhat.com (Postfix) id 73F176017E; Fri, 11 Oct 2019 21:27:58 +0000 (UTC) Received: from himantopus.redhat.com (ovpn-118-45.phx2.redhat.com [10.3.118.45]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3928C600CC; Fri, 11 Oct 2019 21:27:58 +0000 (UTC) From: Jonathon Jongsma To: libvir-list@redhat.com Date: Fri, 11 Oct 2019 16:27:48 -0500 Message-Id: <20191011212752.27139-3-jjongsma@redhat.com> In-Reply-To: <20191011212752.27139-1-jjongsma@redhat.com> References: <20191011212752.27139-1-jjongsma@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v2 2/6] qemu: use VIR_AUTOUNREF 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.65]); Fri, 11 Oct 2019 21:28:03 +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 dc7568fe18..516ae7e444 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -7197,8 +7197,8 @@ qemuDomainDeviceDefValidate(const virDomainDeviceDef = *dev, { int ret =3D 0; virQEMUDriverPtr driver =3D opaque; - virQEMUCapsPtr qemuCaps =3D NULL; - virDomainCapsPtr domCaps =3D NULL; + VIR_AUTOUNREF(virQEMUCapsPtr) qemuCaps =3D NULL; + VIR_AUTOUNREF(virDomainCapsPtr) domCaps =3D NULL; =20 if (!(qemuCaps =3D virQEMUCapsCacheLookup(driver->qemuCapsCache, def->emulator))) @@ -7208,13 +7208,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 (virDomainCapsDeviceDefValidate(domCaps, dev, def) < 0) - goto cleanup; + return ret; =20 switch ((virDomainDeviceType)dev->type) { case VIR_DOMAIN_DEVICE_NET: @@ -7300,9 +7300,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