From nobody Mon Apr 29 05:00: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=1601507315; cv=none; d=zohomail.com; s=zohoarc; b=I/11fve0H3dvdByAccCQt8OyI3vGsR3phhGcxtDf8/hxR+xkrsPK/1tNK8aNa8BFF/067Hsp4TjlEfXwZ6YMW1NaowHKJ6K/Qmy4NjnVD0K5xvvX3x8KojbAP+hpsXEX8rxO4WLN9OLoH+EA5L5Z3/6jfmlJVSNeMtSICzjUB5w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1601507315; 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=y0eErWUXR/33yibTdJ+AlQLj1QGFbRq4Ot4VuBG7TZQ=; b=ILEUoOTXLcTwmvNbtYACvV7lUHipw6RBuGJw1Y8H0bswW2vAyJJeJWHYVGuZSVKJwK687X7ZcUI/6xYTdTwxBQlzXvbHwSRbXrb5E3jEthXh5fF2U0k7osm5r/7wza5Obph8YQmv0RPwZLh15TZDvwMNhN8Tl3/uO88TDEBhfqE= 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 1601507315534366.2143092783566; Wed, 30 Sep 2020 16:08:35 -0700 (PDT) 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-404-lolZ-UbbNFadLG8PlgXdJQ-1; Wed, 30 Sep 2020 19:08:32 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 28DD9186840F; Wed, 30 Sep 2020 23:08:27 +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 EC79D7880B; Wed, 30 Sep 2020 23:08:24 +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 66DE244A4C; Wed, 30 Sep 2020 23:08:20 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 08UN8JVS027281 for ; Wed, 30 Sep 2020 19:08:19 -0400 Received: by smtp.corp.redhat.com (Postfix) id 3AC6455762; Wed, 30 Sep 2020 23:08:19 +0000 (UTC) Received: from vhost2.laine.org (ovpn-112-224.phx2.redhat.com [10.3.112.224]) by smtp.corp.redhat.com (Postfix) with ESMTP id E9B283782 for ; Wed, 30 Sep 2020 23:08:18 +0000 (UTC) Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1601507314; 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=y0eErWUXR/33yibTdJ+AlQLj1QGFbRq4Ot4VuBG7TZQ=; b=haCXlUg/xl9vqOPMcw6yW4y+icE1sWZzlhoKP/0tRVwWQCLYwfRgrEKG7x8iBBtwBFqO+k MoSXTv1R3wqEUnT9olDz8C6JhNZN/+Wpp2y/KF8GpLuPK1NZ5/d4ekFlfXERvE+QWthY3u a3dPazcAqje2fJ5mg+7Wq6I+EWKXA+A= X-MC-Unique: lolZ-UbbNFadLG8PlgXdJQ-1 From: Laine Stump To: libvir-list@redhat.com Subject: [PATCH 1/3] qemu: eliminate use of virDomainNetDefClear() in qemuConnectDomainXMLToNative() Date: Wed, 30 Sep 2020 19:08:09 -0400 Message-Id: <20200930230811.408300-2-laine@redhat.com> In-Reply-To: <20200930230811.408300-1-laine@redhat.com> References: <20200930230811.408300-1-laine@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 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.11 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" Instead of saving the interesting pieces of each existing NetDef, clearing it, and then copying back the saved pieces after setting the type to ethernet, just create a new NetDef, copy in the interesting bits, and replace the old one. (The end game is to eliminate virDomainNetDefClear() completely, since this is the only real use) Signed-off-by: Laine Stump Reviewed-by: Michal Privoznik --- src/qemu/qemu_driver.c | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index b27f05992b..19e2aff3e4 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -6456,24 +6456,20 @@ static char *qemuConnectDomainXMLToNative(virConnec= tPtr conn, */ for (i =3D 0; i < vm->def->nnets; i++) { virDomainNetDefPtr net =3D vm->def->nets[i]; - unsigned int bootIndex =3D net->info.bootIndex; - g_autofree char *model =3D NULL; - virMacAddr mac =3D net->mac; - char *script =3D net->script; + virDomainNetDefPtr newNet =3D virDomainNetDefNew(driver->xmlopt); =20 - model =3D g_strdup(virDomainNetGetModelString(net)); - - net->script =3D NULL; - - virDomainNetDefClear(net); + if (!newNet) + goto cleanup; =20 - net->type =3D VIR_DOMAIN_NET_TYPE_ETHERNET; - net->info.bootIndex =3D bootIndex; - net->mac =3D mac; - net->script =3D script; + newNet->type =3D VIR_DOMAIN_NET_TYPE_ETHERNET; + newNet->info.bootIndex =3D net->info.bootIndex; + newNet->model =3D net->model; + newNet->modelstr =3D g_steal_pointer(&net->modelstr); + newNet->mac =3D net->mac; + newNet->script =3D g_steal_pointer(&net->script); =20 - if (virDomainNetSetModelString(net, model) < 0) - goto cleanup; + virDomainNetDefFree(net); + vm->def->nets[i] =3D newNet; } =20 if (!(cmd =3D qemuProcessCreatePretendCmd(driver, vm, NULL, --=20 2.26.2 From nobody Mon Apr 29 05:00: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=1601507347; cv=none; d=zohomail.com; s=zohoarc; b=ITV7hob/aLkojBidg4kUl3t9eG3WxoiXGL79psWUl/db64jTCJtaG3Cof6iDJE3OAgNajXeqV2PkBTWeoP59a/Rtl3i5hpYyEOckp1M7YdA2qSI2ehXoqCsONhezCpEWBvogadN6dRjA1fWOlbtQpHTVJAVLJhW6taAWPAqSFu4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1601507347; 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=ZUXPFzNwyxhFl/l5B0/rqJZUMPdxCuBObljvUFBnCHA=; b=RQ3x19F6QV8Ddw3GXI5B1q2cC7M+tRl0fgYMfXkxmBADFMchwFfrQ+tPDlXlVXsOpOOGrOAKkQpsmLJu7g9zoXj4oAeRqsd9ZHe/euWtVGtyOzcxHdpDr0P91QMbKvjpMk5vUFSMqCfPp0JdZ55Ib2ZcR2USWo+VWh4O18e5Z44= 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 1601507347192662.7033486601858; Wed, 30 Sep 2020 16:09:07 -0700 (PDT) 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-332-MDROlZ1OPdC16xF6bRqqnA-1; Wed, 30 Sep 2020 19:08:44 -0400 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 6988D1008549; Wed, 30 Sep 2020 23:08:39 +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 493B05D9DC; Wed, 30 Sep 2020 23:08:39 +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 1321244A5D; Wed, 30 Sep 2020 23:08:39 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 08UN8JaN027289 for ; Wed, 30 Sep 2020 19:08:19 -0400 Received: by smtp.corp.redhat.com (Postfix) id AF5595578A; Wed, 30 Sep 2020 23:08:19 +0000 (UTC) Received: from vhost2.laine.org (ovpn-112-224.phx2.redhat.com [10.3.112.224]) by smtp.corp.redhat.com (Postfix) with ESMTP id 66FB75578D for ; Wed, 30 Sep 2020 23:08:19 +0000 (UTC) Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1601507345; 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=ZUXPFzNwyxhFl/l5B0/rqJZUMPdxCuBObljvUFBnCHA=; b=Wkn8LpHq99UEXF+as7DT7t7v2MCjbi281sPFznA108gVBGvpGMpOg6tp22J03AiAzQvVrv RO9TCLsNm1aW14zF5qMsrRuyTcIW9rkYAcfu6KTpcR5ZzFbs99Fv0UN2NihrsvDMKscB5H kpdozTYeB3ONdtEtXyU3SzNktQbznCc= X-MC-Unique: MDROlZ1OPdC16xF6bRqqnA-1 From: Laine Stump To: libvir-list@redhat.com Subject: [PATCH 2/3] conf: eliminate virDomainNetDefClear() Date: Wed, 30 Sep 2020 19:08:10 -0400 Message-Id: <20200930230811.408300-3-laine@redhat.com> In-Reply-To: <20200930230811.408300-1-laine@redhat.com> References: <20200930230811.408300-1-laine@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 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.14 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 no longer used anywhere except virDomainNetDefFree(), so just inline its contents there. Signed-off-by: Laine Stump Reviewed-by: Michal Privoznik --- src/conf/domain_conf.c | 9 +-------- src/conf/domain_conf.h | 1 - src/libvirt_private.syms | 1 - 3 files changed, 1 insertion(+), 10 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index a91dbd4aa9..df5171301d 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -2491,7 +2491,7 @@ virDomainVsockDefFree(virDomainVsockDefPtr vsock) =20 =20 void -virDomainNetDefClear(virDomainNetDefPtr def) +virDomainNetDefFree(virDomainNetDefPtr def) { if (!def) return; @@ -2566,14 +2566,7 @@ virDomainNetDefClear(virDomainNetDefPtr def) virNetDevBandwidthFree(def->bandwidth); def->bandwidth =3D NULL; virNetDevVlanClear(&def->vlan); -} =20 -void -virDomainNetDefFree(virDomainNetDefPtr def) -{ - if (!def) - return; - virDomainNetDefClear(def); virObjectUnref(def->privateData); VIR_FREE(def); } diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 8f1662aae0..9a44315519 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -3056,7 +3056,6 @@ void virDomainActualNetDefFree(virDomainActualNetDefP= tr def); virDomainVsockDefPtr virDomainVsockDefNew(virDomainXMLOptionPtr xmlopt); void virDomainVsockDefFree(virDomainVsockDefPtr vsock); G_DEFINE_AUTOPTR_CLEANUP_FUNC(virDomainVsockDef, virDomainVsockDefFree); -void virDomainNetDefClear(virDomainNetDefPtr def); void virDomainNetDefFree(virDomainNetDefPtr def); void virDomainSmartcardDefFree(virDomainSmartcardDefPtr def); void virDomainChrDefFree(virDomainChrDefPtr def); diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 6bcbfa667d..4e66385bab 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -507,7 +507,6 @@ virDomainNetARPInterfaces; virDomainNetBandwidthUpdate; virDomainNetDefActualFromNetworkPort; virDomainNetDefActualToNetworkPort; -virDomainNetDefClear; virDomainNetDefFormat; virDomainNetDefFree; virDomainNetDefNew; --=20 2.26.2 From nobody Mon Apr 29 05:00: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=1601507331; cv=none; d=zohomail.com; s=zohoarc; b=Jxbt6iFwIyB5Q/7A7jCdacz84YkkS8Ok0cEBO1LEsJ8YPqRYZ7r5CGD3UeaI1HWkVtSR+XPgXhmECYWPrGQP3uM+weHiJW05ZUX6th83W6fUQpl7Q6e+l6k3rIY11qG2Gb2xS1pdOoOpGM004eXIgx7RMFCkELAKmH/Lzf3Y2JI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1601507331; 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=WtTnPyX8fkTjC0fta5S0VHq+ozFmd7dibTi07MVclcc=; b=ZFeH1OQFjCiH1ygkQlHLdmR3Pya8oXcfbSHcqpetGcSxvNFNoQnyHQvue/NNN3zsnwSnH/1xn+S3jYaaTO/T0kc01IG0de1xDIdfDTuSapo7e/OteWNs8wCGoMaz2Z/8alVJHPKuWlYgFTt1rMBgItij/RuG8WxbMZxiGLgwBr4= 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 1601507331394859.8426417131376; Wed, 30 Sep 2020 16:08:51 -0700 (PDT) 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-201-YTmd4RwlOqqk_y2LY2-F4w-1; Wed, 30 Sep 2020 19:08:47 -0400 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 012EF1008542; Wed, 30 Sep 2020 23:08:41 +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 CF29C5D9DC; Wed, 30 Sep 2020 23:08:41 +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 9B001183D024; Wed, 30 Sep 2020 23:08:41 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 08UN8KNm027294 for ; Wed, 30 Sep 2020 19:08:20 -0400 Received: by smtp.corp.redhat.com (Postfix) id 2CBF655762; Wed, 30 Sep 2020 23:08:20 +0000 (UTC) Received: from vhost2.laine.org (ovpn-112-224.phx2.redhat.com [10.3.112.224]) by smtp.corp.redhat.com (Postfix) with ESMTP id DABE93782 for ; Wed, 30 Sep 2020 23:08:19 +0000 (UTC) Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1601507330; 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=WtTnPyX8fkTjC0fta5S0VHq+ozFmd7dibTi07MVclcc=; b=QHuCh3Fy8D9yLgkey13J+q6N4txI0VtqTxZekXOr5zmsA8O4ig8F20+MX/hY/kJMZ50gpB kHmYYIYlSP0z4ae6Pn4SDYrMveZ+SFhBLNx0i0TVEQGe+gInxDwGTeV/a8l/j1tDBPV9oN u+pnR0OMaEEOgN6sgbs5kmF0SHoSPtY= X-MC-Unique: YTmd4RwlOqqk_y2LY2-F4w-1 From: Laine Stump To: libvir-list@redhat.com Subject: [PATCH 3/3] conf: use g_free() instead of VIR_FREE in virDomainNetDefFree() Date: Wed, 30 Sep 2020 19:08:11 -0400 Message-Id: <20200930230811.408300-4-laine@redhat.com> In-Reply-To: <20200930230811.408300-1-laine@redhat.com> References: <20200930230811.408300-1-laine@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 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.14 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" All these lines were moved over from the now-defunct virDomainNetDefClear(), which required all pointers to be cleared after free, but virDomainNetDefFree() doesn't have that restriction - after free'ing the pointers are never again referenced, so g_free() is safe. Signed-off-by: Laine Stump Reviewed-by: Michal Privoznik --- src/conf/domain_conf.c | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index df5171301d..7292dceb6b 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -2509,27 +2509,27 @@ virDomainNetDefFree(virDomainNetDefPtr def) case VIR_DOMAIN_NET_TYPE_CLIENT: case VIR_DOMAIN_NET_TYPE_MCAST: case VIR_DOMAIN_NET_TYPE_UDP: - VIR_FREE(def->data.socket.address); - VIR_FREE(def->data.socket.localaddr); + g_free(def->data.socket.address); + g_free(def->data.socket.localaddr); break; =20 case VIR_DOMAIN_NET_TYPE_NETWORK: - VIR_FREE(def->data.network.name); - VIR_FREE(def->data.network.portgroup); + g_free(def->data.network.name); + g_free(def->data.network.portgroup); virDomainActualNetDefFree(def->data.network.actual); def->data.network.actual =3D NULL; break; =20 case VIR_DOMAIN_NET_TYPE_BRIDGE: - VIR_FREE(def->data.bridge.brname); + g_free(def->data.bridge.brname); break; =20 case VIR_DOMAIN_NET_TYPE_INTERNAL: - VIR_FREE(def->data.internal.name); + g_free(def->data.internal.name); break; =20 case VIR_DOMAIN_NET_TYPE_DIRECT: - VIR_FREE(def->data.direct.linkdev); + g_free(def->data.direct.linkdev); break; =20 case VIR_DOMAIN_NET_TYPE_HOSTDEV: @@ -2542,24 +2542,24 @@ virDomainNetDefFree(virDomainNetDefPtr def) break; } =20 - VIR_FREE(def->backend.tap); - VIR_FREE(def->backend.vhost); - VIR_FREE(def->teaming.persistent); - VIR_FREE(def->virtPortProfile); - VIR_FREE(def->script); - VIR_FREE(def->downscript); - VIR_FREE(def->domain_name); - VIR_FREE(def->ifname); - VIR_FREE(def->ifname_guest); - VIR_FREE(def->ifname_guest_actual); - VIR_FREE(def->virtio); - VIR_FREE(def->coalesce); + g_free(def->backend.tap); + g_free(def->backend.vhost); + g_free(def->teaming.persistent); + g_free(def->virtPortProfile); + g_free(def->script); + g_free(def->downscript); + g_free(def->domain_name); + g_free(def->ifname); + g_free(def->ifname_guest); + g_free(def->ifname_guest_actual); + g_free(def->virtio); + g_free(def->coalesce); =20 virNetDevIPInfoClear(&def->guestIP); virNetDevIPInfoClear(&def->hostIP); virDomainDeviceInfoClear(&def->info); =20 - VIR_FREE(def->filter); + g_free(def->filter); virHashFree(def->filterparams); def->filterparams =3D NULL; =20 @@ -2568,7 +2568,7 @@ virDomainNetDefFree(virDomainNetDefPtr def) virNetDevVlanClear(&def->vlan); =20 virObjectUnref(def->privateData); - VIR_FREE(def); + g_free(def); } =20 =20 --=20 2.26.2