From nobody Mon Nov 25 21:36:28 2024 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=1594156570; cv=none; d=zohomail.com; s=zohoarc; b=nZHihtYrb7sWr733WAU4Y35lTlxfap21v7mvgP9Dst98bNSpkaR9dVG0tuV6yEv10+20BCVAK5O5eg0z1VJOKrVj1qm4Z3f8gGm5g/K3Z6pPMpkjREOqO/fMF2XqnfvLN/oe8R6vrNmo483aVH47Bd06s5lPBEfHQ/s49gFCT8c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1594156570; 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=3uaB9vSrSoYEevjwFWBu2r9liSzb4qpRXtjKQPm5cT0=; b=V+h+B/5brOgCld4bGaKq8svEM/Wg0wjVZNdEErkuHvJXeGWJkKmgPnaztyGHAtE8PJfhaESODDtjlWkYtYKc+dtqKWYz5a+rzgyYyYhlxkX98PGCIn3s/6+XI/s6xbB/1k4GOhzD2syMoKrMtNlKEDCCQxDi3c/wtrmSSsP07Bc= 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-1.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 1594156570762895.5959366733067; Tue, 7 Jul 2020 14:16:10 -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-402-VXe-F0vqOv6GvhLVhJp1Nw-1; Tue, 07 Jul 2020 17:15:01 -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 35477107ACCA; Tue, 7 Jul 2020 21:14:55 +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 13F9379248; Tue, 7 Jul 2020 21:14:55 +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 D633772F6B; Tue, 7 Jul 2020 21:14:54 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 067L8Q7a007976 for ; Tue, 7 Jul 2020 17:08:26 -0400 Received: by smtp.corp.redhat.com (Postfix) id 7FBE8797E0; Tue, 7 Jul 2020 21:08:26 +0000 (UTC) Received: from vhost2.laine.org (ovpn-112-194.phx2.redhat.com [10.3.112.194]) by smtp.corp.redhat.com (Postfix) with ESMTP id 38DD579220 for ; Tue, 7 Jul 2020 21:08:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1594156569; 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=3uaB9vSrSoYEevjwFWBu2r9liSzb4qpRXtjKQPm5cT0=; b=cnz7Rd3ZJ2981pWWy24+WJbpLvKw8X+gyjUzUsc3TQ6loYMhufNOb5UA2paIW9jTD3c6++ E1kgBnJZstxhrqREh4YghBlo1ZBoryd1oaQdCGDbT/hTl2T/Hi/cypcAZpAgqBCTZ5XhEe mtdnQuKF/Lu8Hb8PRovsbyG7ZZaFXOQ= X-MC-Unique: VXe-F0vqOv6GvhLVhJp1Nw-1 From: Laine Stump To: libvir-list@redhat.com Subject: [libvirt PATCH v2 07/15] network: use g_free() in place of remaining VIR_FREE() Date: Tue, 7 Jul 2020 17:08:07 -0400 Message-Id: <20200707210815.1797463-8-laine@redhat.com> In-Reply-To: <20200707210815.1797463-1-laine@redhat.com> References: <20200707210815.1797463-1-laine@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 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" Signed-off-by: Laine Stump Reviewed-by: J=C3=A1n Tomko --- src/network/bridge_driver.c | 45 +++++++++++++++++++------------------ 1 file changed, 23 insertions(+), 22 deletions(-) diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c index 79b2ca3330..7d81d4dd78 100644 --- a/src/network/bridge_driver.c +++ b/src/network/bridge_driver.c @@ -158,7 +158,7 @@ networkDnsmasqDefNamespaceFree(void *nsdata) =20 virStringListFreeCount(def->options, def->noptions); =20 - VIR_FREE(def); + g_free(def); } G_DEFINE_AUTOPTR_CLEANUP_FUNC(networkDnsmasqXmlNsDef, networkDnsmasqDefNam= espaceFree); =20 @@ -707,7 +707,7 @@ networkStateInitialize(bool privileged, =20 network_driver->lockFD =3D -1; if (virMutexInit(&network_driver->lock) < 0) { - VIR_FREE(network_driver); + g_clear_pointer(&network_driver, g_free); goto error; } =20 @@ -875,18 +875,18 @@ 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_clear_pointer(&network_driver, g_free); =20 return 0; } @@ -2194,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 @@ -2207,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) { @@ -2714,19 +2714,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_clear_pointer(&netdef->forward.ifs, g_free); =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 @@ -3162,7 +3162,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; } @@ -4272,7 +4272,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; } @@ -4396,7 +4396,7 @@ networkAllocatePort(virNetworkObjPtr obj, return -1; } if (portprofile) { - VIR_FREE(port->virtPortProfile); + g_free(port->virtPortProfile); port->virtPortProfile =3D portprofile; } =20 @@ -5513,9 +5513,10 @@ networkPortSetParameters(virNetworkPortPtr port, * 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); + g_clear_pointer(&bandwidth->in, g_free); + if (!bandwidth->out->average) - VIR_FREE(bandwidth->out); + g_clear_pointer(&bandwidth->out, g_free); =20 if (networkUpdatePortBandwidth(obj, &portdef->mac, --=20 2.25.4