From nobody Mon Feb 9 01:48:29 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=1569514448; cv=none; d=zoho.com; s=zohoarc; b=R2KZ+C1nKiWR6Tgf+U/E157kiOafdZB6eTVlXxuRXM2mjntNglSV0NWicHkklxiVaXCLSRcTI59maKvIXmgeqqIRITTEySW8+4pxJHiRl3Va3wErvxFa5UCSRDn1c8RpcdZHLgz5GGvVtJwYBjAecJDLdHkMV3kukWWyPisHYPY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1569514448; 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=m/82C8sTiCVatVpDWDOtHhoTRFrNGUcYXeaCd7zxAuk=; b=auQuMclBAlsv1VnANwg+GMGM5Hj4Cq9gjpvkMguEwtSySk+ErIJb0jZ5mM7K96i8tgrxRsxALG3GY6U/Ed02cGynQAeOnVTO4l/thrOfxj3AsyTwL9BIaGmFitka/3tVkQVlnpaEbL5LBCpdPRqYK/MVfOhgXvimhdSpEDpKBwA= 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 1569514448507496.5552688235699; Thu, 26 Sep 2019 09:14:08 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 94386116BB26; Thu, 26 Sep 2019 16:14:06 +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 711D85D9C3; Thu, 26 Sep 2019 16:14:06 +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 33C351803518; Thu, 26 Sep 2019 16:14:06 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x8QGDpvV003316 for ; Thu, 26 Sep 2019 12:13:51 -0400 Received: by smtp.corp.redhat.com (Postfix) id 0FB355D9DC; Thu, 26 Sep 2019 16:13:51 +0000 (UTC) Received: from moe.brq.redhat.com (unknown [10.43.2.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8B9335D9D5 for ; Thu, 26 Sep 2019 16:13:50 +0000 (UTC) From: Michal Privoznik To: libvir-list@redhat.com Date: Thu, 26 Sep 2019 18:12:06 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v2 10/39] qemuDomainGetHostdevPath: Use more VIR_AUTOFREE/VIR_AUTOPTR 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.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.6.2 (mx1.redhat.com [10.5.110.65]); Thu, 26 Sep 2019 16:14:07 +0000 (UTC) Content-Type: text/plain; charset="utf-8" There are several variables which could be automatically freed upon return from the function. I'm not changing @tmpPaths (which is a string list) because it is going to be removed in next commit. Signed-off-by: Michal Privoznik Reviewed-by: Cole Robinson --- src/qemu/qemu_domain.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index c903750fa0..d8d2f72bcc 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -12866,14 +12866,14 @@ qemuDomainGetHostdevPath(virDomainDefPtr def, virDomainHostdevSubsysSCSIPtr scsisrc =3D &dev->source.subsys.u.scsi; virDomainHostdevSubsysSCSIVHostPtr hostsrc =3D &dev->source.subsys.u.s= csi_host; virDomainHostdevSubsysMediatedDevPtr mdevsrc =3D &dev->source.subsys.u= .mdev; - virPCIDevicePtr pci =3D NULL; - virUSBDevicePtr usb =3D NULL; - virSCSIDevicePtr scsi =3D NULL; - virSCSIVHostDevicePtr host =3D NULL; - char *tmpPath =3D NULL; + VIR_AUTOPTR(virPCIDevice) pci =3D NULL; + VIR_AUTOPTR(virUSBDevice) usb =3D NULL; + VIR_AUTOPTR(virSCSIDevice) scsi =3D NULL; + VIR_AUTOPTR(virSCSIVHostDevice) host =3D NULL; + VIR_AUTOFREE(char *) tmpPath =3D NULL; bool includeVFIO =3D false; char **tmpPaths =3D NULL; - int *tmpPerms =3D NULL; + VIR_AUTOFREE(int *) tmpPerms =3D NULL; size_t tmpNpaths =3D 0; int perm =3D 0; =20 @@ -13004,12 +13004,6 @@ qemuDomainGetHostdevPath(virDomainDefPtr def, ret =3D 0; cleanup: virStringListFreeCount(tmpPaths, tmpNpaths); - VIR_FREE(tmpPerms); - virPCIDeviceFree(pci); - virUSBDeviceFree(usb); - virSCSIDeviceFree(scsi); - virSCSIVHostDeviceFree(host); - VIR_FREE(tmpPath); return ret; } =20 --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list