From nobody Tue Feb 10 01:58:46 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) client-ip=205.139.110.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 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=1577973501; cv=none; d=zohomail.com; s=zohoarc; b=NOCv7Apgv0W3sV9Ng8ywexz92uuE67T8goB3mBEIUNFzLLtpWncqebTUzMaMOTLH6U4kkJ+IGC+0LUcpjNZYF3nbBk0MzbZLaV4JenQcKDoC/FoPneXzKsCu/7YXDjaNMq4ycixsqBVH8KnLGKu4HUB919f2PDZd2juMxxYUWOM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1577973501; h=Content-Type:Content-Transfer-Encoding:Cc: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=q93pU4oqjC5Zmh1jtA7CRB/CZFuCUNgYWo2/wPAJ62Y=; b=SUsmMACcvZzV0GLbXS6vNURNgOAh8Ai0WeJpYuKiJPdClfo9X5kWUuICWGFlQeQ2Z7dNh1u7O+9Hk8XyLbVvPekgvM1WMAXika5hQbdUwWYkjKtwL43MxEbGmlkbKlmAvqSnylweHzLQ2OHaF/e1IgQBoEHSES5BObmmw0eK8Cc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 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-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by mx.zohomail.com with SMTPS id 1577973501515610.6868652666755; Thu, 2 Jan 2020 05:58:21 -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-4-a9_HAWGYPDaYyi5CkgeSsg-1; Thu, 02 Jan 2020 08:58:17 -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 063B3801E7E; Thu, 2 Jan 2020 13:58:12 +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 9B54060C87; Thu, 2 Jan 2020 13:58:11 +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 A311081E07; Thu, 2 Jan 2020 13:58:10 +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 002Dw9Zt002292 for ; Thu, 2 Jan 2020 08:58:09 -0500 Received: by smtp.corp.redhat.com (Postfix) id 96B517A057; Thu, 2 Jan 2020 13:58:09 +0000 (UTC) Received: from laerte.redhat.com (unknown [10.43.2.64]) by smtp.corp.redhat.com (Postfix) with ESMTP id EA03B7039B; Thu, 2 Jan 2020 13:58:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1577973500; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc: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=q93pU4oqjC5Zmh1jtA7CRB/CZFuCUNgYWo2/wPAJ62Y=; b=JrgX0lTn5Qd/uVTPTyK+MzfV/MCEE/aT4f0Pd/9HyNxAcLVNxoxBLRyATTaXRO18H4ZBMw CY9UHpcAp52iuqdS/l4JFIeVYaq6nb6bupejaPhwDd+bXfoSyM0+QLBQXRvahrIoFg0qgq Y1P4vHOfOfha2Us4szQb0DzpW8KB+rY= From: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= To: libvir-list@redhat.com Date: Thu, 2 Jan 2020 14:57:54 +0100 Message-Id: <20200102135758.848454-4-fidencio@redhat.com> In-Reply-To: <20200102135758.848454-1-fidencio@redhat.com> References: <20200102135758.848454-1-fidencio@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Cc: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= Subject: [libvirt] [PATCH 3/7] util: Use g_auto/g_autofree in virFirewallAddRuleFullV() 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 X-MC-Unique: a9_HAWGYPDaYyi5CkgeSsg-1 X-Mimecast-Spam-Score: 0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Signed-off-by: Fabiano Fid=C3=AAncio --- src/util/virfirewall.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/util/virfirewall.c b/src/util/virfirewall.c index 00b1bd0a97..d6fff31318 100644 --- a/src/util/virfirewall.c +++ b/src/util/virfirewall.c @@ -257,6 +257,7 @@ virFirewallRuleFree(virFirewallRulePtr rule) VIR_FREE(rule); } =20 +G_DEFINE_AUTO_CLEANUP_FREE_FUNC(virFirewallRulePtr, virFirewallRuleFree, N= ULL); =20 static void virFirewallGroupFree(virFirewallGroupPtr group) @@ -335,8 +336,8 @@ virFirewallAddRuleFullV(virFirewallPtr firewall, va_list args) { virFirewallGroupPtr group; - virFirewallRulePtr rule; - char *str; + g_auto(virFirewallRulePtr) rule =3D NULL; + g_autofree char *str =3D NULL; =20 VIR_FIREWALL_RETURN_NULL_IF_ERROR(firewall); =20 @@ -348,7 +349,7 @@ virFirewallAddRuleFullV(virFirewallPtr firewall, =20 =20 if (VIR_ALLOC(rule) < 0) - goto cleanup; + return NULL; =20 rule->layer =3D layer; rule->queryCB =3D cb; @@ -379,19 +380,18 @@ virFirewallAddRuleFullV(virFirewallPtr firewall, if (VIR_APPEND_ELEMENT_COPY(group->rollback, group->nrollback, rule) < 0) - goto cleanup; + return NULL; } else { if (VIR_APPEND_ELEMENT_COPY(group->action, group->naction, rule) < 0) - goto cleanup; + return NULL; } =20 =20 - return rule; + return g_steal_pointer(&rule); =20 cleanup: - virFirewallRuleFree(rule); return NULL; } =20 --=20 2.24.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list