From nobody Sun Apr 28 12:16:05 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 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=1613109266; cv=none; d=zohomail.com; s=zohoarc; b=YhgEWRt0FY6titMYK0PoBTrnMai14ht/LirOYjXn9E1sUroH9JR5mscYT+SPlEUTgkovEGoz8gXmJVvHpUWjBU1YDUydqNdxU3s6MsKomTeALq1JmrEslDk1Z3fcm3f5/dcUwstXn9no3ESlcI2oNYgwhEBZNkBaPoYKVHFLhys= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1613109266; 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=bK1B+/gYyyLIJja5R74z+4BCg0i39OTvUBSeVrwWcTc=; b=Cb0ahZxIElFscS/OfQCdctlkjisaeHMwmkAb/GZxiuBtv3jRcUV67Rxq4zE3jI0qi9l81gqVswslYmAFnhyk4LVYX6SitT4DynyzjL/sb//6FWZOKBkhcjJwRXkbxBDgqZG9VDgHPYvwDWhkn5ElHHRPFaYfqXVrScFOW5gEXfY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1613109266584720.5541102831527; Thu, 11 Feb 2021 21:54:26 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-522-w0sFwcg7NvySyitCzITlRQ-1; Fri, 12 Feb 2021 00:54:20 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 6F65A803F4A; Fri, 12 Feb 2021 05:54:14 +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 1BBBD10016F6; Fri, 12 Feb 2021 05:54:14 +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 4DB0E58074; Fri, 12 Feb 2021 05:54:13 +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 11C5sClk019804 for ; Fri, 12 Feb 2021 00:54:12 -0500 Received: by smtp.corp.redhat.com (Postfix) id B09F61A87D; Fri, 12 Feb 2021 05:54:12 +0000 (UTC) Received: from vhost2.router.laine.org (ovpn-112-48.phx2.redhat.com [10.3.112.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id 780BA1F4 for ; Fri, 12 Feb 2021 05:54:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1613109265; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=bK1B+/gYyyLIJja5R74z+4BCg0i39OTvUBSeVrwWcTc=; b=NrHrSAjiRsuRwXMD31+ew+STwftwNbVK6ReDF3WGG7godwEWhUl2HVpQqKKr6J+RsdC8Kw icy8wr/o1kC6+Amd3kuwOQliMMs6ILmbJt8exrG68Vh9FBatUk1BFYShsg5Q6nnTOZrX0k bxZDuc7ycMnu0HLDKP86RavMSHF8yU8= X-MC-Unique: w0sFwcg7NvySyitCzITlRQ-1 From: Laine Stump To: libvir-list@redhat.com Subject: [libvirt RFC PATCH 1/5] conf: rename and narrow scope of virDomainHostdevDefClear() Date: Fri, 12 Feb 2021 00:54:03 -0500 Message-Id: <20210212055407.685776-2-laine@redhat.com> In-Reply-To: <20210212055407.685776-1-laine@redhat.com> References: <20210212055407.685776-1-laine@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" This function had the name "Clear", but some of its fields were being cleared, and others were just being freed, but the pointers not cleared. In fact, all the uses of virDomainHostdevDefClear() ended up freeing the memory containing the HosdevDef immediately after clearing it. So it is acceptable to change the VIR_FREEs in this function to g_frees, but that would be confusing to future me, who will have forgotten that a "cleared" hostdevdef is never re-used. In order to eliminate the confusion, we can rename the function to virDomainHostdevDefFreeContents(), which is more accurate (doesn't make false claims). In the meantime, this function was only ever called from other functions within the same file, so there is no need for it to be declared in domain_conf.h, much less be listed among the exported functions in libvirt_private.syms, so lets just make this renamed function static for efficiency's sake. Signed-off-by: Laine Stump --- src/conf/domain_conf.c | 19 +++++++++++-------- src/conf/domain_conf.h | 1 - src/libvirt_private.syms | 1 - 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 17e0d1ed31..3b9d0da232 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -1339,6 +1339,7 @@ static virClassPtr virDomainXMLOptionClass; static void virDomainObjDispose(void *obj); static void virDomainXMLOptionDispose(void *obj); =20 +static void virDomainHostdevDefFreeContents(virDomainHostdevDefPtr def); =20 static void virDomainChrSourceDefFormat(virBufferPtr buf, @@ -2430,7 +2431,7 @@ virDomainActualNetDefFree(virDomainActualNetDefPtr de= f) g_free(def->data.direct.linkdev); break; case VIR_DOMAIN_NET_TYPE_HOSTDEV: - virDomainHostdevDefClear(&def->data.hostdev.def); + virDomainHostdevDefFree(&def->data.hostdev.def); break; default: break; @@ -2531,7 +2532,7 @@ virDomainNetDefFree(virDomainNetDefPtr def) break; =20 case VIR_DOMAIN_NET_TYPE_HOSTDEV: - virDomainHostdevDefClear(&def->data.hostdev.def); + virDomainHostdevDefFree(&def->data.hostdev.def); break; =20 case VIR_DOMAIN_NET_TYPE_ETHERNET: @@ -3009,7 +3010,8 @@ virDomainHostdevSubsysSCSIClear(virDomainHostdevSubsy= sSCSIPtr scsisrc) } =20 =20 -void virDomainHostdevDefClear(virDomainHostdevDefPtr def) +static void +virDomainHostdevDefFreeContents(virDomainHostdevDefPtr def) { if (!def) return; @@ -3030,13 +3032,13 @@ void virDomainHostdevDefClear(virDomainHostdevDefPt= r def) case VIR_DOMAIN_HOSTDEV_MODE_CAPABILITIES: switch ((virDomainHostdevCapsType) def->source.caps.type) { case VIR_DOMAIN_HOSTDEV_CAPS_TYPE_STORAGE: - VIR_FREE(def->source.caps.u.storage.block); + g_free(def->source.caps.u.storage.block); break; case VIR_DOMAIN_HOSTDEV_CAPS_TYPE_MISC: - VIR_FREE(def->source.caps.u.misc.chardev); + g_free(def->source.caps.u.misc.chardev); break; case VIR_DOMAIN_HOSTDEV_CAPS_TYPE_NET: - VIR_FREE(def->source.caps.u.net.ifname); + g_free(def->source.caps.u.net.ifname); virNetDevIPInfoClear(&def->source.caps.u.net.ip); break; case VIR_DOMAIN_HOSTDEV_CAPS_TYPE_LAST: @@ -3049,7 +3051,7 @@ void virDomainHostdevDefClear(virDomainHostdevDefPtr = def) virDomainHostdevSubsysSCSIClear(&def->source.subsys.u.scsi); break; case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI_HOST: - VIR_FREE(def->source.subsys.u.scsi_host.wwpn); + g_free(def->source.subsys.u.scsi_host.wwpn); break; case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_USB: case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI: @@ -3061,6 +3063,7 @@ void virDomainHostdevDefClear(virDomainHostdevDefPtr = def) } } =20 + void virDomainTPMDefFree(virDomainTPMDefPtr def) { if (!def) @@ -3089,7 +3092,7 @@ void virDomainHostdevDefFree(virDomainHostdevDefPtr d= ef) return; =20 /* free all subordinate objects */ - virDomainHostdevDefClear(def); + virDomainHostdevDefFreeContents(def); =20 /* If there is a parentnet device object, it will handle freeing * the memory. diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index e263e6098b..415826134d 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -3126,7 +3126,6 @@ void virDomainVideoDefFree(virDomainVideoDefPtr def); G_DEFINE_AUTOPTR_CLEANUP_FUNC(virDomainVideoDef, virDomainVideoDefFree); void virDomainVideoDefClear(virDomainVideoDefPtr def); virDomainHostdevDefPtr virDomainHostdevDefNew(void); -void virDomainHostdevDefClear(virDomainHostdevDefPtr def); void virDomainHostdevDefFree(virDomainHostdevDefPtr def); void virDomainHubDefFree(virDomainHubDefPtr def); void virDomainRedirdevDefFree(virDomainRedirdevDefPtr def); diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 49e665a5f0..e586263a61 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -445,7 +445,6 @@ virDomainGraphicsVNCSharePolicyTypeFromString; virDomainGraphicsVNCSharePolicyTypeToString; virDomainHasNet; virDomainHostdevCapsTypeToString; -virDomainHostdevDefClear; virDomainHostdevDefFree; virDomainHostdevDefNew; virDomainHostdevFind; --=20 2.29.2 From nobody Sun Apr 28 12:16:05 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 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=1613109272; cv=none; d=zohomail.com; s=zohoarc; b=hPK39OXkFyyfKTvmXNZ7p2oSF0b7INihyW1WU/UN09mM/kELEPIVSq0CzHKMSeF46KYMHjPnWdfhhbeMoh3dwGjllS07fkieS9uFcOFbBeVoy3WjlWO5UGkgwgLMVS2Axvz1k7OKgPedo5cWGVk2wN/9vfoW06xPhWk9gK/ssxk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1613109272; 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=kTn5my05Z17/UK8a+Kc6dELBFNuTPCeNdAnP8dFVf/c=; b=CZevB8y7K47XboKLBSV/6TzV9tg8R/5WcqVIggwLuLHQSucC8Igpw5wEPqzAFtrudALh+V4z4bZWSKQz5X12nh0htLIYkHgiV1xrXPZvpehsNjAZSR14iEcgCpAHHDxByeU/G7RRjXBLKWlGRt67pT8QBJDH1x4gkHrGXGYpZ6o= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 1613109272537480.37013274601213; Thu, 11 Feb 2021 21:54:32 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-174-KFmQDALsMjuoSG20Qp-mow-1; Fri, 12 Feb 2021 00:54:29 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D97DC1895801; Fri, 12 Feb 2021 05:54:23 +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 A73F71F456; Fri, 12 Feb 2021 05:54:23 +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 3B73B18095CE; Fri, 12 Feb 2021 05:54:23 +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 11C5sDne019809 for ; Fri, 12 Feb 2021 00:54:13 -0500 Received: by smtp.corp.redhat.com (Postfix) id 1942E1A87D; Fri, 12 Feb 2021 05:54:13 +0000 (UTC) Received: from vhost2.router.laine.org (ovpn-112-48.phx2.redhat.com [10.3.112.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id D56FE1F4 for ; Fri, 12 Feb 2021 05:54:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1613109271; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=kTn5my05Z17/UK8a+Kc6dELBFNuTPCeNdAnP8dFVf/c=; b=fUyESFxye9VRzpKcg9VzXAubdnFRxlkQYc+tHs4AZLjHewm9KsA757tORpYke8pM6bEcYf 2lhxsCeGPmAQjhElzAZJdccpf2LoX++LivmWR9j1gGj2Ix/ZSh4Pq+oa+RzIeTRcqVFL3b YgHcdH5cDlCQrc5jQahOfztTMC4WKzU= X-MC-Unique: KFmQDALsMjuoSG20Qp-mow-1 From: Laine Stump To: libvir-list@redhat.com Subject: [libvirt RFC PATCH 2/5] conf: rename virDomainHostdevSubsysSCSIClear Date: Fri, 12 Feb 2021 00:54:04 -0500 Message-Id: <20210212055407.685776-3-laine@redhat.com> In-Reply-To: <20210212055407.685776-1-laine@redhat.com> References: <20210212055407.685776-1-laine@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" This function is only called from one place, and the object being "cleared" is never again referenced before being freed, so it doesn't need to be "cleared", just change its name to *FreeContents() so that we can remove its VIR_FREEs with a "clear" conscience (pun intended). Signed-off-by: Laine Stump --- src/conf/domain_conf.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 3b9d0da232..3505d29dbe 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -2997,13 +2997,13 @@ virDomainHostdevDefNew(void) =20 =20 static void -virDomainHostdevSubsysSCSIClear(virDomainHostdevSubsysSCSIPtr scsisrc) +virDomainHostdevSubsysSCSIFreeContents(virDomainHostdevSubsysSCSIPtr scsis= rc) { if (scsisrc->protocol =3D=3D VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE_ISC= SI) { virObjectUnref(scsisrc->u.iscsi.src); scsisrc->u.iscsi.src =3D NULL; } else { - VIR_FREE(scsisrc->u.host.adapter); + g_free(scsisrc->u.host.adapter); virObjectUnref(scsisrc->u.host.src); scsisrc->u.host.src =3D NULL; } @@ -3048,7 +3048,7 @@ virDomainHostdevDefFreeContents(virDomainHostdevDefPt= r def) case VIR_DOMAIN_HOSTDEV_MODE_SUBSYS: switch ((virDomainHostdevSubsysType) def->source.subsys.type) { case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI: - virDomainHostdevSubsysSCSIClear(&def->source.subsys.u.scsi); + virDomainHostdevSubsysSCSIFreeContents(&def->source.subsys.u.s= csi); break; case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI_HOST: g_free(def->source.subsys.u.scsi_host.wwpn); --=20 2.29.2 From nobody Sun Apr 28 12:16:05 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 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=1613109274; cv=none; d=zohomail.com; s=zohoarc; b=FYPdQgx3+fdMHiaN6cQn2aUcV9BT1/2H4l/CI0EB3HFBZepvtKGA64t2CyF+DMnmsCNajFsAtU+w7wuPYBjnZtOx9HF0dUyBSpYkRqCXI/CDgziISjdXiaVq+PWN5mQpj4LL8npAKR71bmyHPDoIm9Fsug5JS+EX0KHPZ3Qujko= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1613109274; 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=NH5NwJtZPBZW3IueV26Uh8zzPreF96RB6rXQWIErQUI=; b=JEU7Lj+MZAVmBlt07Qm6DGHWYD01lFk1QKmzy0gEo46Pvi6O99sDb5z3QDF69adw6pCGxDzmsF21sUJRclRX08sfa1FQw89A35pYVi/iYvp6nnOSMZxx9ZlbA9i61syPbIX6/crg9HhSnctKyH/aWeLVoPaGPXDi6jOECwYQpzM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 1613109273659208.3403967258281; Thu, 11 Feb 2021 21:54:33 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-164-hYtFNhM9Oh6k3vO8V8BF2Q-1; Fri, 12 Feb 2021 00:54:29 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id A880C427CE; Fri, 12 Feb 2021 05:54:23 +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 7A52B10016F6; Fri, 12 Feb 2021 05:54:23 +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 34EE918095CD; Fri, 12 Feb 2021 05:54:23 +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 11C5sDtW019815 for ; Fri, 12 Feb 2021 00:54:13 -0500 Received: by smtp.corp.redhat.com (Postfix) id 75BA61F4; Fri, 12 Feb 2021 05:54:13 +0000 (UTC) Received: from vhost2.router.laine.org (ovpn-112-48.phx2.redhat.com [10.3.112.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3DD071F455 for ; Fri, 12 Feb 2021 05:54:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1613109272; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=NH5NwJtZPBZW3IueV26Uh8zzPreF96RB6rXQWIErQUI=; b=d/N3rV/3HI4ISowtWYj5Byfvct5SO6xhpWFm7qkKaYrU+CinLLAqQXBMPycXWvMN0LZgCW Zdxs2L2ZSIbDHB1LcO2UkVSqtoEfN9pkh+rtsxmeUw6ikDpXmpLFS58okGsUgg2yCQfuAj AM/iwGsx5OaNXoWKFg/75qrwmTvjjcM= X-MC-Unique: hYtFNhM9Oh6k3vO8V8BF2Q-1 From: Laine Stump To: libvir-list@redhat.com Subject: [libvirt RFC PATCH 3/5] conf: replace pointless VIR_FREEs with g_free in virDomainVideoDefClear() Date: Fri, 12 Feb 2021 00:54:05 -0500 Message-Id: <20210212055407.685776-4-laine@redhat.com> In-Reply-To: <20210212055407.685776-1-laine@redhat.com> References: <20210212055407.685776-1-laine@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" This function does a memset(0) at the end anyway, so there's no point in VIR_FREE vs g_free. Signed-off-by: Laine Stump --- src/conf/domain_conf.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 3505d29dbe..d8b8ef38f5 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -2960,13 +2960,13 @@ virDomainVideoDefClear(virDomainVideoDefPtr def) virDomainDeviceInfoClear(&def->info); =20 if (def->accel) - VIR_FREE(def->accel->rendernode); - VIR_FREE(def->accel); - VIR_FREE(def->res); - VIR_FREE(def->virtio); + g_free(def->accel->rendernode); + g_free(def->accel); + g_free(def->res); + g_free(def->virtio); if (def->driver) - VIR_FREE(def->driver->vhost_user_binary); - VIR_FREE(def->driver); + g_free(def->driver->vhost_user_binary); + g_free(def->driver); virObjectUnref(def->privateData); =20 memset(def, 0, sizeof(*def)); --=20 2.29.2 From nobody Sun Apr 28 12:16:05 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 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=1613109304; cv=none; d=zohomail.com; s=zohoarc; b=UtSudAGi4L/d0r72jNA4UJq5+AAv6L43dtLUMfICWcizcgxW6VNyCos34Zos7Bjov/CpNC49c3CH3aBb97De0DR3/peQO7Zq/MdcJBTEQSwz70KiT5+28Mm2z5n6ZY6gXTTfAS7xUuAfagY5Xd369JzwD6RTN3cPt7ln8Y1LCRY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1613109304; 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=OakbKK7MnHWlA5zjWphfDV5kzrKIRIHfjf5X3ATsx4k=; b=nQFEKE6qktgNAcY3amWHknyGGMz8AUjqQci3AR0BemBvGfM7g6zp/f1U/vhli2Pg1DJDnOPt+VzavEbLgLf574211W0rF4gBwU6cT5roKX4i5eigjr4qCJJXV1ANFGmwZtmMGwWTbCdYDvGprp26StfiXI/C9IP+rw7cEeaPmiw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1613109303925514.0561186840456; Thu, 11 Feb 2021 21:55:03 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-479-YB1NZATEPeyDf4j6RQ3msg-1; Fri, 12 Feb 2021 00:54:32 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 9875518957F5; Fri, 12 Feb 2021 05:54:26 +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 7705C60C64; Fri, 12 Feb 2021 05:54:26 +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 0D8C11809C92; Fri, 12 Feb 2021 05:54:26 +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 11C5sDmL019823 for ; Fri, 12 Feb 2021 00:54:13 -0500 Received: by smtp.corp.redhat.com (Postfix) id D0F6E1A87D; Fri, 12 Feb 2021 05:54:13 +0000 (UTC) Received: from vhost2.router.laine.org (ovpn-112-48.phx2.redhat.com [10.3.112.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id 999521F4 for ; Fri, 12 Feb 2021 05:54:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1613109302; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=OakbKK7MnHWlA5zjWphfDV5kzrKIRIHfjf5X3ATsx4k=; b=CQQ00/uMQsQvWvT6+k0F25jWuaF7BzStCmQwFAh4CUye+auRtXFS+rs4CM/gKjxGVGLrjj KU8L6Cye9TOjezf3c83R9U8oC5oReUbjOADLXIG0veoPmdo3hZY57zNY0jYriDl0o/EgUx QLY0Ja3S2b+75avW79Z1NsWUUQdxO2A= X-MC-Unique: YB1NZATEPeyDf4j6RQ3msg-1 From: Laine Stump To: libvir-list@redhat.com Subject: [libvirt RFC PATCH 4/5] conf: don't call virDomainDeviceInfoClear from virDomainDeviceInfoParseXML Date: Fri, 12 Feb 2021 00:54:06 -0500 Message-Id: <20210212055407.685776-5-laine@redhat.com> In-Reply-To: <20210212055407.685776-1-laine@redhat.com> References: <20210212055407.685776-1-laine@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" The DeviceInfo object sent to virDomainDeviceInfoParseXML() was allocated with g_new0() just prior to the call (although in each case there is some other code in between, none of it touches the DeviceInfo); pretty clearly, the call to virDomainDeviceInfoClear() at the top of virDomainDeviceInfoParseXML() was just overly paranoid "safety code", and is unnecessary. Likewise, the call to clear the device info on return when there is a parse failure is also unnecessary, since in every case the caller immediately frees the object after the failure. So let's remove these. Signed-off-by: Laine Stump --- src/conf/domain_conf.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index d8b8ef38f5..f2b00129e1 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -6533,8 +6533,6 @@ virDomainDeviceInfoParseXML(virDomainXMLOptionPtr xml= opt, g_autofree char *rombar =3D NULL; g_autofree char *aliasStr =3D NULL; =20 - virDomainDeviceInfoClear(info); - cur =3D node->children; while (cur !=3D NULL) { if (cur->type =3D=3D XML_ELEMENT_NODE) { @@ -6611,8 +6609,6 @@ virDomainDeviceInfoParseXML(virDomainXMLOptionPtr xml= opt, =20 ret =3D 0; cleanup: - if (ret < 0) - virDomainDeviceInfoClear(info); return ret; } =20 --=20 2.29.2 From nobody Sun Apr 28 12:16:05 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 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=1613109275; cv=none; d=zohomail.com; s=zohoarc; b=MTnVrJ1OtEvsPQpYVGHBa25aCq1PxtS455czlw/i2plsYdxcral+lOKpJh8V0ahyWqc1Fddx4gXGcWNt4VLuLNuMaTY4vjGBkeT41cYnfsQgCYhA8FGdU0532JkuQtLk+QEF1RUe+YEBQcJf/MhzHfGxaVWqs53KcsK0W4QfVq4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1613109275; 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=0qBK4QOiDp5UZAXr5Nin0qjbjY/aNEaXTACbqJTCtuo=; b=YSAzoGtx24bSTelvLh41wMQJp8Zna3NPKcStYrycCoOI0nhDzEBD/fK7dsnXoZ0BHCGvA9cGgRXmpK+1wS4W+bv4nHTlH3HbCfZTI5lldgCBs5fb822VNbKhxCBbTSJ2deVw8ygVGc2jzCZO+tNN4uG0UJ1++LW2SXLrzL3MsZs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 1613109275799796.1587685410583; Thu, 11 Feb 2021 21:54:35 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-372-JAtOZ5G9Ne-KdGVckIrs9w-1; Fri, 12 Feb 2021 00:54:32 -0500 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id EFC77427CD; Fri, 12 Feb 2021 05:54:26 +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 CEA337086E; Fri, 12 Feb 2021 05:54:26 +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 9A63F58078; Fri, 12 Feb 2021 05:54:26 +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 11C5sE3V019833 for ; Fri, 12 Feb 2021 00:54:14 -0500 Received: by smtp.corp.redhat.com (Postfix) id 3A20F1F4; Fri, 12 Feb 2021 05:54:14 +0000 (UTC) Received: from vhost2.router.laine.org (ovpn-112-48.phx2.redhat.com [10.3.112.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id 01FD11A87D for ; Fri, 12 Feb 2021 05:54:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1613109274; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=0qBK4QOiDp5UZAXr5Nin0qjbjY/aNEaXTACbqJTCtuo=; b=J4yN2sy5bkVLU37EaULAW7o9qipOmviUHWNUduDZfEZSyi7kLZzljlpxdf4/6QD3V45Sf3 x5XCZZJLq8FHj9bdAunqRVbpI24JncwREKGemhtDrK8px5V5OaVFcuJcc7/VKixJZZ0eWQ qR2saCpuEJb3MFMX0DmkhkkuRvm2R8w= X-MC-Unique: JAtOZ5G9Ne-KdGVckIrs9w-1 From: Laine Stump To: libvir-list@redhat.com Subject: [libvirt RFC PATCH 5/5] conf: replace virDomainDeviceInfoClear with virDomainDeviceInfoFreeContents Date: Fri, 12 Feb 2021 00:54:07 -0500 Message-Id: <20210212055407.685776-6-laine@redhat.com> In-Reply-To: <20210212055407.685776-1-laine@redhat.com> References: <20210212055407.685776-1-laine@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" In every case where virDomainDeviceInfoClear() is still being called, the object containing the DeviceInfo is freed immediately thereafter (yes, I checked them all!). This means we don't need to clear any of the data in the DeviceInfo, just free memory that it points to. Signed-off-by: Laine Stump --- src/conf/device_conf.c | 15 ++++++--------- src/conf/device_conf.h | 2 +- src/conf/domain_conf.c | 40 ++++++++++++++++++++-------------------- 3 files changed, 27 insertions(+), 30 deletions(-) diff --git a/src/conf/device_conf.c b/src/conf/device_conf.c index 714ac50762..743d7f7468 100644 --- a/src/conf/device_conf.c +++ b/src/conf/device_conf.c @@ -83,22 +83,19 @@ virZPCIDeviceAddressParseXML(xmlNodePtr node, } =20 void -virDomainDeviceInfoClear(virDomainDeviceInfoPtr info) +virDomainDeviceInfoFreeContents(virDomainDeviceInfoPtr info) { - VIR_FREE(info->alias); - memset(&info->addr, 0, sizeof(info->addr)); - info->type =3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE; - VIR_FREE(info->romfile); - VIR_FREE(info->loadparm); - info->isolationGroup =3D 0; - info->isolationGroupLocked =3D false; + g_free(info->alias); + g_free(info->romfile); + g_free(info->loadparm); } =20 + void virDomainDeviceInfoFree(virDomainDeviceInfoPtr info) { if (info) { - virDomainDeviceInfoClear(info); + virDomainDeviceInfoFreeContents(info); g_free(info); } } diff --git a/src/conf/device_conf.h b/src/conf/device_conf.h index a51bdf10ee..444d1b16c6 100644 --- a/src/conf/device_conf.h +++ b/src/conf/device_conf.h @@ -181,7 +181,7 @@ struct _virDomainDeviceInfo { bool isolationGroupLocked; }; =20 -void virDomainDeviceInfoClear(virDomainDeviceInfoPtr info); +void virDomainDeviceInfoFreeContents(virDomainDeviceInfoPtr info); void virDomainDeviceInfoFree(virDomainDeviceInfoPtr info); =20 bool virDomainDeviceInfoAddressIsEqual(const virDomainDeviceInfo *a, diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index f2b00129e1..b8db94974b 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -1880,7 +1880,7 @@ void virDomainInputDefFree(virDomainInputDefPtr def) if (!def) return; =20 - virDomainDeviceInfoClear(&def->info); + virDomainDeviceInfoFreeContents(&def->info); g_free(def->source.evdev); g_free(def->virtio); g_free(def); @@ -2210,7 +2210,7 @@ virDomainDiskDefFree(virDomainDiskDefPtr def) g_free(def->domain_name); g_free(def->blkdeviotune.group_name); g_free(def->virtio); - virDomainDeviceInfoClear(&def->info); + virDomainDeviceInfoFreeContents(&def->info); virObjectUnref(def->privateData); =20 g_free(def); @@ -2342,7 +2342,7 @@ void virDomainControllerDefFree(virDomainControllerDe= fPtr def) if (!def) return; =20 - virDomainDeviceInfoClear(&def->info); + virDomainDeviceInfoFreeContents(&def->info); g_free(def->virtio); =20 g_free(def); @@ -2408,7 +2408,7 @@ void virDomainFSDefFree(virDomainFSDefPtr def) =20 virObjectUnref(def->src); g_free(def->dst); - virDomainDeviceInfoClear(&def->info); + virDomainDeviceInfoFreeContents(&def->info); g_free(def->virtio); virObjectUnref(def->privateData); g_free(def->binary); @@ -2471,7 +2471,7 @@ virDomainVsockDefFree(virDomainVsockDefPtr vsock) return; =20 virObjectUnref(vsock->privateData); - virDomainDeviceInfoClear(&vsock->info); + virDomainDeviceInfoFreeContents(&vsock->info); g_free(vsock->virtio); g_free(vsock); } @@ -2556,7 +2556,7 @@ virDomainNetDefFree(virDomainNetDefPtr def) =20 virNetDevIPInfoClear(&def->guestIP); virNetDevIPInfoClear(&def->hostIP); - virDomainDeviceInfoClear(&def->info); + virDomainDeviceInfoFreeContents(&def->info); =20 g_free(def->filter); virHashFree(def->filterparams); @@ -2806,7 +2806,7 @@ void virDomainChrDefFree(virDomainChrDefPtr def) } =20 virObjectUnref(def->source); - virDomainDeviceInfoClear(&def->info); + virDomainDeviceInfoFreeContents(&def->info); =20 g_free(def); } @@ -2835,7 +2835,7 @@ void virDomainSmartcardDefFree(virDomainSmartcardDefP= tr def) break; } =20 - virDomainDeviceInfoClear(&def->info); + virDomainDeviceInfoFreeContents(&def->info); =20 g_free(def); } @@ -2855,7 +2855,7 @@ void virDomainSoundDefFree(virDomainSoundDefPtr def) if (!def) return; =20 - virDomainDeviceInfoClear(&def->info); + virDomainDeviceInfoFreeContents(&def->info); =20 for (i =3D 0; i < def->ncodecs; i++) virDomainSoundCodecDefFree(def->codecs[i]); @@ -2895,7 +2895,7 @@ void virDomainMemballoonDefFree(virDomainMemballoonDe= fPtr def) if (!def) return; =20 - virDomainDeviceInfoClear(&def->info); + virDomainDeviceInfoFreeContents(&def->info); g_free(def->virtio); =20 g_free(def); @@ -2906,7 +2906,7 @@ void virDomainNVRAMDefFree(virDomainNVRAMDefPtr def) if (!def) return; =20 - virDomainDeviceInfoClear(&def->info); + virDomainDeviceInfoFreeContents(&def->info); =20 g_free(def); } @@ -2916,7 +2916,7 @@ void virDomainWatchdogDefFree(virDomainWatchdogDefPtr= def) if (!def) return; =20 - virDomainDeviceInfoClear(&def->info); + virDomainDeviceInfoFreeContents(&def->info); =20 g_free(def); } @@ -2926,7 +2926,7 @@ void virDomainShmemDefFree(virDomainShmemDefPtr def) if (!def) return; =20 - virDomainDeviceInfoClear(&def->info); + virDomainDeviceInfoFreeContents(&def->info); virDomainChrSourceDefClear(&def->server.chr); g_free(def->name); g_free(def); @@ -2957,7 +2957,7 @@ virDomainVideoDefClear(virDomainVideoDefPtr def) if (!def) return; =20 - virDomainDeviceInfoClear(&def->info); + virDomainDeviceInfoFreeContents(&def->info); =20 if (def->accel) g_free(def->accel->rendernode); @@ -3082,7 +3082,7 @@ void virDomainTPMDefFree(virDomainTPMDefPtr def) break; } =20 - virDomainDeviceInfoClear(&def->info); + virDomainDeviceInfoFreeContents(&def->info); g_free(def); } =20 @@ -3106,7 +3106,7 @@ void virDomainHubDefFree(virDomainHubDefPtr def) if (!def) return; =20 - virDomainDeviceInfoClear(&def->info); + virDomainDeviceInfoFreeContents(&def->info); g_free(def); } =20 @@ -3116,7 +3116,7 @@ void virDomainRedirdevDefFree(virDomainRedirdevDefPtr= def) return; =20 virObjectUnref(def->source); - virDomainDeviceInfoClear(&def->info); + virDomainDeviceInfoFreeContents(&def->info); =20 g_free(def); } @@ -3143,7 +3143,7 @@ void virDomainMemoryDefFree(virDomainMemoryDefPtr def) g_free(def->nvdimmPath); virBitmapFree(def->sourceNodes); g_free(def->uuid); - virDomainDeviceInfoClear(&def->info); + virDomainDeviceInfoFreeContents(&def->info); g_free(def); } =20 @@ -3352,7 +3352,7 @@ virDomainPanicDefFree(virDomainPanicDefPtr panic) if (!panic) return; =20 - virDomainDeviceInfoClear(&panic->info); + virDomainDeviceInfoFreeContents(&panic->info); g_free(panic); } =20 @@ -26579,7 +26579,7 @@ virDomainRNGDefFree(virDomainRNGDefPtr def) break; } =20 - virDomainDeviceInfoClear(&def->info); + virDomainDeviceInfoFreeContents(&def->info); g_free(def->virtio); g_free(def); } --=20 2.29.2