From nobody Sun Feb 8 13:40:06 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.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 170.10.133.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=1660050932; cv=none; d=zohomail.com; s=zohoarc; b=UdRF2oP/PhuJlFrpLNQ3iJOunVEqksK2jGj8x+7eFRh3PL8x2lxXCpYAodjnRC9CnfdQ5wILLONHS98DvUsWSwCkDrnNBM73dIEdDb2VD42EdiD+D3xIuCtvlnMc38l9hdKDP6LGfUoP5JJF5bkY+J8SFP9CWzCgYxeopCTGc2Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1660050932; 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=KQRU9XtLXjkauOtxzgNp1BMSWB4GWxRIIvlp+5ZexaQ=; b=Zwlc8j4Bpx7PUnDtm89AWjROalM5zR6dptAuwFeBv7GMhLTZnIlhbmxq5YyNm45mLO69UXC4WOkh5rHYPQBUIV9DMx0i1a0awawUgdhY6fbg0bWC9EbH/WDxNgJ/dbJeRQP1Q43l4fiDEQMGfxpkuaQZHn/nduhvQ8PixAU78uk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1660050932726197.7597387823596; Tue, 9 Aug 2022 06:15:32 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-414-P9KidmJ6P--sGrajcVCYsw-1; Tue, 09 Aug 2022 09:14:09 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id ECED21C01B5D; Tue, 9 Aug 2022 13:14:02 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id DA88A1121314; Tue, 9 Aug 2022 13:14:02 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 8C2AE1946A52; Tue, 9 Aug 2022 13:14:02 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id C319E1946A5A for ; Tue, 9 Aug 2022 13:13:59 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 8F37A40CFD0A; Tue, 9 Aug 2022 13:13:59 +0000 (UTC) Received: from maggie.redhat.com (unknown [10.43.2.39]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3AF3640CF8EB for ; Tue, 9 Aug 2022 13:13:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1660050930; 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=KQRU9XtLXjkauOtxzgNp1BMSWB4GWxRIIvlp+5ZexaQ=; b=W55L6lLB05VaoaunF9hVlL1jRFC52WmTWlBlsHzox73yuoJS7LnQjoAbMp/uR1j3aAEAz8 CgQZrdYSiZSVnqsQDU8S1PNPMEX7wPS6MCVGn+w6f1j/jVkDXjtRx8+vCuo4nXbL1iwAno 0s6XpPgbheItqQcNx3csgVyubPgy660= X-MC-Unique: P9KidmJ6P--sGrajcVCYsw-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 2/5] bridge_driver: Use g_autoptr() for virMacMap Date: Tue, 9 Aug 2022 15:13:54 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.11.54.1 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1660050933952100001 Content-Type: text/plain; charset="utf-8"; x-default="true" Let's annotate virMacMap variables in bridge_driver.c with g_autoptr() so that they are automatically freed upon error. This may look like a needless commit, since there's no memory leak currently, but it simplifies the next commit. Signed-off-by: Michal Privoznik --- src/network/bridge_driver.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c index 7ad9f278a2..a07af55390 100644 --- a/src/network/bridge_driver.c +++ b/src/network/bridge_driver.c @@ -450,7 +450,7 @@ networkUpdateState(virNetworkObj *obj, virNetworkDef *def; virNetworkDriverState *driver =3D opaque; g_autoptr(dnsmasqCaps) dnsmasq_caps =3D networkGetDnsmasqCaps(driver); - virMacMap *macmap; + g_autoptr(virMacMap) macmap =3D NULL; g_autofree char *macMapFile =3D NULL; VIR_LOCK_GUARD lock =3D virObjectLockGuard(obj); =20 @@ -476,6 +476,7 @@ networkUpdateState(virNetworkObj *obj, return -1; =20 virNetworkObjSetMacMap(obj, macmap); + macmap =3D NULL; =20 break; =20 @@ -1938,7 +1939,7 @@ networkStartNetworkVirtual(virNetworkDriverState *dri= ver, virErrorPtr save_err =3D NULL; virNetworkIPDef *ipdef; virNetDevIPRoute *routedef; - virMacMap *macmap; + g_autoptr(virMacMap) macmap =3D NULL; g_autofree char *macMapFile =3D NULL; bool dnsmasqStarted =3D false; bool devOnline =3D false; --=20 2.35.1