From nobody Sun Feb 8 21:29:02 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=1563015534; cv=none; d=zoho.com; s=zohoarc; b=LPE431X+hBquV47lVUeTRLbdJ+XnnH6t0iC7GlazWX1e03o+OYPapNWKcQKBiVPYhn0LaphNKFjxsDTJMuRMoDT7I8JJ1ZA4L++iGcEyeYb1VmCj9dcze79tPH1O9lEka6wyoB/XkP98NNXT0OZK4QkYw8VjycBDnGLr8CPHzDc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1563015534; 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:ARC-Authentication-Results; bh=2ZI9NTgJ8PMEdQeKow8kgTqasol//fde/F7oR7rUNlY=; b=JIkYcWs2fpUqv9NZUc7z4Y40YXaZepJmb1xqa2sE7bQDrXso+GXfetzB+G/22CawL1LxaP8e9C+JCtH1Vj0JD9NZifx7z0o1AARz6gEUn2TjvcOsq2aGS5bIG8mBlShYQW/wlTFCZkQweFh9x3BzdqF9VPA8sAvXB0qBLqXys7Y= 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 1563015534872563.4929579297897; Sat, 13 Jul 2019 03:58:54 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id F3C0281F13; Sat, 13 Jul 2019 10:58:52 +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 B93935C207; Sat, 13 Jul 2019 10:58:52 +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 AF70D41F53; Sat, 13 Jul 2019 10:58:49 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x6DAwmv3010217 for ; Sat, 13 Jul 2019 06:58:48 -0400 Received: by smtp.corp.redhat.com (Postfix) id AEE77196A0; Sat, 13 Jul 2019 10:58:48 +0000 (UTC) Received: from localhost.localdomain (ovpn-204-18.brq.redhat.com [10.40.204.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7645919699; Sat, 13 Jul 2019 10:58:47 +0000 (UTC) From: Michal Privoznik To: libvir-list@redhat.com Date: Sat, 13 Jul 2019 12:58:35 +0200 Message-Id: <11f20684a99d7a3bb97c685045638726c32d7f2f.1563015448.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com Cc: abologna@redhat.com Subject: [libvirt] [PATCH 2/5] libvirt_nss: Use VIR_AUTOPTR and VIR_AUTOFREE 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.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Sat, 13 Jul 2019 10:58:53 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Signed-off-by: Michal Privoznik Reviewed-by: Erik Skultety --- tools/nss/libvirt_nss.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/tools/nss/libvirt_nss.c b/tools/nss/libvirt_nss.c index 4de960d6f1..e55bf144bc 100644 --- a/tools/nss/libvirt_nss.c +++ b/tools/nss/libvirt_nss.c @@ -244,11 +244,11 @@ findLease(const char *name, int ret =3D -1; const char *leaseDir =3D LEASEDIR; struct dirent *entry; - virJSONValuePtr leases_array =3D NULL; + VIR_AUTOPTR(virJSONValue) leases_array =3D NULL; ssize_t nleases; - leaseAddress *tmpAddress =3D NULL; + VIR_AUTOFREE(leaseAddress *) tmpAddress =3D NULL; size_t ntmpAddress =3D 0; - virMacMapPtr *macmaps =3D NULL; + VIR_AUTOFREE(virMacMapPtr *) macmaps =3D NULL; size_t nMacmaps =3D 0; =20 *address =3D NULL; @@ -340,12 +340,9 @@ findLease(const char *name, =20 cleanup: *errnop =3D errno; - VIR_FREE(tmpAddress); - virJSONValueFree(leases_array); VIR_DIR_CLOSE(dir); while (nMacmaps) virObjectUnref(macmaps[--nMacmaps]); - VIR_FREE(macmaps); return ret; } =20 @@ -389,7 +386,7 @@ NSS_NAME(gethostbyname3)(const char *name, int af, stru= ct hostent *result, { enum nss_status ret =3D NSS_STATUS_UNAVAIL; char *r_name, **r_aliases, *r_addr, *r_addr_next, **r_addr_list; - leaseAddress *addr =3D NULL; + VIR_AUTOFREE(leaseAddress *) addr =3D NULL; size_t naddr, i; bool found =3D false; size_t nameLen, need, idx =3D 0; @@ -495,7 +492,6 @@ NSS_NAME(gethostbyname3)(const char *name, int af, stru= ct hostent *result, =20 ret =3D NSS_STATUS_SUCCESS; cleanup: - VIR_FREE(addr); return ret; } =20 --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list