From nobody Sun Feb 8 19:44:27 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 1554480277889953.9866027868699; Fri, 5 Apr 2019 09:04:37 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1747888AC2; Fri, 5 Apr 2019 16:04:36 +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 DC97E60D62; Fri, 5 Apr 2019 16:04:35 +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 986B6181AC46; Fri, 5 Apr 2019 16:04:35 +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 x35G4Y3v003419 for ; Fri, 5 Apr 2019 12:04:34 -0400 Received: by smtp.corp.redhat.com (Postfix) id 3BAFF60C8D; Fri, 5 Apr 2019 16:04:34 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.229]) by smtp.corp.redhat.com (Postfix) with ESMTP id B9A7A60BFB for ; Fri, 5 Apr 2019 16:04:33 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Fri, 5 Apr 2019 18:04:17 +0200 Message-Id: <99e5398666012b4a32801fad30e0868bf2f34b8a.1554480066.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 05/11] qemu: block: Use VIR_AUTOPTR for virHashTablePtr 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.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Fri, 05 Apr 2019 16:04:36 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_block.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c index 0504a79957..b00f4c6f8e 100644 --- a/src/qemu/qemu_block.c +++ b/src/qemu/qemu_block.c @@ -240,8 +240,8 @@ qemuBlockNodeNameGetBackingChain(virJSONValuePtr namedn= odes, virJSONValuePtr blockstats) { struct qemuBlockNodeNameGetBackingChainData data; - virHashTablePtr namednodestable =3D NULL; - virHashTablePtr disks =3D NULL; + VIR_AUTOPTR(virHashTable) namednodestable =3D NULL; + VIR_AUTOPTR(virHashTable) disks =3D NULL; virHashTablePtr ret =3D NULL; memset(&data, 0, sizeof(data)); @@ -268,8 +268,6 @@ qemuBlockNodeNameGetBackingChain(virJSONValuePtr namedn= odes, VIR_STEAL_PTR(ret, disks); cleanup: - virHashFree(namednodestable); - virHashFree(disks); return ret; } @@ -344,7 +342,7 @@ qemuBlockNodeNamesDetect(virQEMUDriverPtr driver, qemuDomainAsyncJob asyncJob) { qemuDomainObjPrivatePtr priv =3D vm->privateData; - virHashTablePtr disktable =3D NULL; + VIR_AUTOPTR(virHashTable) disktable =3D NULL; VIR_AUTOPTR(virJSONValue) data =3D NULL; VIR_AUTOPTR(virJSONValue) blockstats =3D NULL; virDomainDiskDefPtr disk; @@ -376,7 +374,6 @@ qemuBlockNodeNamesDetect(virQEMUDriverPtr driver, ret =3D 0; cleanup: - virHashFree(disktable); return ret; } @@ -394,19 +391,20 @@ qemuBlockNodeNamesDetect(virQEMUDriverPtr driver, virHashTablePtr qemuBlockGetNodeData(virJSONValuePtr data) { + VIR_AUTOPTR(virHashTable) nodedata =3D NULL; virHashTablePtr ret =3D NULL; - if (!(ret =3D virHashCreate(50, virJSONValueHashFree))) + if (!(nodedata =3D virHashCreate(50, virJSONValueHashFree))) return NULL; if (virJSONValueArrayForeachSteal(data, - qemuBlockNamedNodesArrayToHash, ret)= < 0) + qemuBlockNamedNodesArrayToHash, node= data) < 0) goto error; + VIR_STEAL_PTR(ret, nodedata); return ret; error: - virHashFree(ret); return NULL; } --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list