From nobody Mon Feb 9 20:10:58 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) client-ip=207.211.31.81; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 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=1593056092; cv=none; d=zohomail.com; s=zohoarc; b=HDM603jQl78w6TDegS4vT9yWcqy5RBIVP4NQck0SkjfjcHMTPnWSatw6fh8+F00goQ7LZmwNQGZCaonoE43u+EE6+oE8uM48Gzdx4wQ7peCQlp7udNIhVHc+53xsv3O6Jd8XE5tB2fuhJSkQQQwYbludlIpwgtyJQ6amHDIyDUI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1593056092; 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=L8Xa46olbM8EwlDPnwVTGX4pP9T4mJJuDCFNCZPUXv0=; b=MUVouaNR9fz+boDaYlzyKem+8zVL9EKYf0Y4YMr5qJaB2Hx17dUGJluHWRqtd61/tRmggeAdIfqZPjSjr0EBi7UF8BxCg2boQ0QQz2Z14C5aCHob9NH6RMisAiFGP62VZwiFfA8D0MQ3Y3RrZEVckLS8cAO4CMQytw/mjTZrmF0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 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-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 1593056092817169.23369573111563; Wed, 24 Jun 2020 20:34:52 -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-319-N1sNZiH7OCyQMjkqDUEGNA-1; Wed, 24 Jun 2020 23:34:49 -0400 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 EBF94804012; Thu, 25 Jun 2020 03:34:38 +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 C913291D99; Thu, 25 Jun 2020 03:34:38 +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 96DB3875A7; Thu, 25 Jun 2020 03:34:38 +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 05P3YRmZ007838 for ; Wed, 24 Jun 2020 23:34:27 -0400 Received: by smtp.corp.redhat.com (Postfix) id 046345BAE5; Thu, 25 Jun 2020 03:34:27 +0000 (UTC) Received: from vhost2.laine.org (ovpn-114-28.phx2.redhat.com [10.3.114.28]) by smtp.corp.redhat.com (Postfix) with ESMTP id B576A5BACC for ; Thu, 25 Jun 2020 03:34:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1593056091; 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=L8Xa46olbM8EwlDPnwVTGX4pP9T4mJJuDCFNCZPUXv0=; b=fuAYkN3/YqlIkLrbxSRmyt3Mmd6yIVlQ2t64OVf7n2WpqfJeHunLXrHK9Gco+PnFjLAYx4 VawiDG8iRtRzSPUyH+gzF5a1KDWldrs8xT27BqWAEt4zV8h+52Q55jIe15RodD/0Q/ay8t uKfwFFyU7djkRfKPa2ysSjXx/TnRKOk= X-MC-Unique: N1sNZiH7OCyQMjkqDUEGNA-1 From: Laine Stump To: libvir-list@redhat.com Subject: [PATCH 11/25] network: use g_free() in place of remaining VIR_FREE() Date: Wed, 24 Jun 2020 23:34:00 -0400 Message-Id: <20200625033414.1819594-12-laine@redhat.com> In-Reply-To: <20200625033414.1819594-1-laine@redhat.com> References: <20200625033414.1819594-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.13 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" Signed-off-by: Laine Stump --- src/network/bridge_driver.c | 59 +++++++++++++++++++++---------------- 1 file changed, 33 insertions(+), 26 deletions(-) diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c index 668aa9ca88..a1b2f5b6c7 100644 --- a/src/network/bridge_driver.c +++ b/src/network/bridge_driver.c @@ -148,7 +148,7 @@ networkDnsmasqDefNamespaceFree(void *nsdata) =20 virStringListFreeCount(def->options, def->noptions); =20 - VIR_FREE(def); + g_free(def); } =20 =20 @@ -706,7 +706,8 @@ networkStateInitialize(bool privileged, =20 network_driver->lockFD =3D -1; if (virMutexInit(&network_driver->lock) < 0) { - VIR_FREE(network_driver); + g_free(network_driver); + network_driver =3D NULL; goto error; } =20 @@ -874,18 +875,19 @@ networkStateCleanup(void) virPidFileRelease(network_driver->stateDir, "driver", network_driver->lockFD); =20 - VIR_FREE(network_driver->networkConfigDir); - VIR_FREE(network_driver->networkAutostartDir); - VIR_FREE(network_driver->stateDir); - VIR_FREE(network_driver->pidDir); - VIR_FREE(network_driver->dnsmasqStateDir); - VIR_FREE(network_driver->radvdStateDir); + g_free(network_driver->networkConfigDir); + g_free(network_driver->networkAutostartDir); + g_free(network_driver->stateDir); + g_free(network_driver->pidDir); + g_free(network_driver->dnsmasqStateDir); + g_free(network_driver->radvdStateDir); =20 virObjectUnref(network_driver->dnsmasqCaps); =20 virMutexDestroy(&network_driver->lock); =20 - VIR_FREE(network_driver); + g_free(network_driver); + network_driver =3D NULL; =20 return 0; } @@ -2192,7 +2194,7 @@ networkSetIPv6Sysctls(virNetworkObjPtr obj) /* Prevent guests from hijacking the host network by sending out * their own router advertisements. */ - VIR_FREE(field); + g_free(field); field =3D g_strdup_printf(SYSCTL_PATH "/net/ipv6/conf/%s/accept_ra", def->bridge); =20 @@ -2205,7 +2207,7 @@ networkSetIPv6Sysctls(virNetworkObjPtr obj) /* All interfaces used as a gateway (which is what this is, by * definition), must always have autoconf=3D0. */ - VIR_FREE(field); + g_free(field); field =3D g_strdup_printf(SYSCTL_PATH "/net/ipv6/conf/%s/autoconf", de= f->bridge); =20 if (virFileWriteStr(field, "0", 0) < 0) { @@ -2713,19 +2715,19 @@ networkCreateInterfacePool(virNetworkDefPtr netdef) for (i =3D 0; i < netdef->forward.nifs; i++) { if (netdef->forward.ifs[i].type =3D=3D VIR_NETWORK_FORWARD_HOSTDEV_DEVICE_NETDEV) - VIR_FREE(netdef->forward.ifs[i].device.dev); + g_free(netdef->forward.ifs[i].device.dev); } netdef->forward.nifs =3D 0; } if (netdef->forward.nifs =3D=3D 0) - VIR_FREE(netdef->forward.ifs); + g_free(netdef->forward.ifs); =20 for (i =3D 0; i < numVirtFns; i++) { - VIR_FREE(vfNames[i]); - VIR_FREE(virtFns[i]); + g_free(vfNames[i]); + g_free(virtFns[i]); } - VIR_FREE(vfNames); - VIR_FREE(virtFns); + g_free(vfNames); + g_free(virtFns); return ret; } =20 @@ -3161,7 +3163,7 @@ networkFindUnusedBridgeName(virNetworkObjListPtr nets, */ if (!(virNetworkObjBridgeInUse(nets, newname, def->name) || virNetDevExists(newname) =3D=3D 1)) { - VIR_FREE(def->bridge); /*could contain template */ + g_free(def->bridge); /*could contain template */ def->bridge =3D g_steal_pointer(&newname); return 0; } @@ -4256,7 +4258,8 @@ networkGetDHCPLeases(virNetworkPtr net, nleases++; } =20 - VIR_FREE(lease); + g_free(lease); + lease =3D NULL; } =20 if (leases_ret) { @@ -4269,7 +4272,7 @@ networkGetDHCPLeases(virNetworkPtr net, rv =3D nleases; =20 cleanup: - VIR_FREE(lease); + g_free(lease); virNetworkObjEndAPI(&obj); =20 return rv; @@ -4278,7 +4281,7 @@ networkGetDHCPLeases(virNetworkPtr net, if (leases_ret) { for (i =3D 0; i < nleases; i++) virNetworkDHCPLeaseFree(leases_ret[i]); - VIR_FREE(leases_ret); + g_free(leases_ret); } goto cleanup; } @@ -4402,7 +4405,7 @@ networkAllocatePort(virNetworkObjPtr obj, return -1; } if (portprofile) { - VIR_FREE(port->virtPortProfile); + g_free(port->virtPortProfile); port->virtPortProfile =3D portprofile; } =20 @@ -5519,10 +5522,14 @@ networkPortSetParameters(virNetworkPortPtr port, /* average or floor are mandatory, peak and burst are optional. * So if no average or floor is given, we free inbound/outbound * here which causes inbound/outbound to not be set. */ - if (!bandwidth->in->average && !bandwidth->in->floor) - VIR_FREE(bandwidth->in); - if (!bandwidth->out->average) - VIR_FREE(bandwidth->out); + if (!bandwidth->in->average && !bandwidth->in->floor) { + g_free(bandwidth->in); + bandwidth->in =3D NULL; + } + if (!bandwidth->out->average) { + g_free(bandwidth->out); + bandwidth->out =3D NULL; + } =20 if (networkUpdatePortBandwidth(obj, &portdef->mac, --=20 2.25.4