From nobody Tue Feb 10 20:28:32 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=1577977258; cv=none; d=zohomail.com; s=zohoarc; b=Ei0sCmUJHYZQqT3Ki3WUu3YS4Z/YKV86GtReyMOCQk7dXPWZgmu7w86L2TdqJ/m/qKT8f73F3aBHQ5J1UGdu27tdxh5jlaLUv/BTiHBUmo9oEHBlShTXxA/F0vEqCpUocAZV6tkgkW6CBvtw8lzBttlWjFIyc+VIuZ86a6c4iSg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1577977258; 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=vu0CaNYgllCNzGLeDjin7NNp12a6R2tt+pYR2trLdiw=; b=c+Mi7VanTL9410RBf01hG7mhZLsXoCpPbbU7BYNimHirv95ouAjXUr5RBMAWvlB5fdVXn+kEyjBOlhjANyvoQ7Fz+pmFzl5Riw+3C/+P9TGELoVwtkhaK1R/sNiX2FwGrgn+emp7243H2btfQNNspIqiknxghDtuqJTp2cz23c8= 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 1577977258077532.5180935506066; Thu, 2 Jan 2020 07:00:58 -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-391-hwvNm2LiMvaNJ2YMlLluIw-1; Thu, 02 Jan 2020 10:00:55 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 71B23CF035; Thu, 2 Jan 2020 15:00:49 +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 0CF56108130C; Thu, 2 Jan 2020 15:00:48 +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 A3B1981E2E; Thu, 2 Jan 2020 15:00:47 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 002F0iXg005799 for ; Thu, 2 Jan 2020 10:00:44 -0500 Received: by smtp.corp.redhat.com (Postfix) id 3037719C5B; Thu, 2 Jan 2020 15:00:44 +0000 (UTC) Received: from laerte.redhat.com (unknown [10.43.2.64]) by smtp.corp.redhat.com (Postfix) with ESMTP id 800B619C4F; Thu, 2 Jan 2020 15:00:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1577977257; 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=vu0CaNYgllCNzGLeDjin7NNp12a6R2tt+pYR2trLdiw=; b=JEvc5aAtx9giWrtbYEDLq+gE7B/9vrF7wnTqNytFBNqrcNe7c9dpWO7Do5cxTTJqO6fWAv R8kXISkRGJk46maqQbSpRjiAYGILp5WdymP7nYCE0+k1IDyFlLMuexnxroNGlyXyu5T1Ht Z7bRBClH/4hLO3u6Ml3CJ8l/3B+NlN0= From: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= To: libvir-list@redhat.com Date: Thu, 2 Jan 2020 16:00:32 +0100 Message-Id: <20200102150035.1085486-3-fidencio@redhat.com> In-Reply-To: <20200102150035.1085486-1-fidencio@redhat.com> References: <20200102150035.1085486-1-fidencio@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com Cc: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= Subject: [libvirt] [PATCH v2 2/5] 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.84 on 10.5.11.22 X-MC-Unique: hwvNm2LiMvaNJ2YMlLluIw-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 6f7b5306e5..2177617ecf 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 no_memory; + 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 no_memory; + return NULL; } else { if (VIR_APPEND_ELEMENT_COPY(group->action, group->naction, rule) < 0) - goto no_memory; + return NULL; } =20 =20 - return rule; + return g_steal_pointer(&rule); =20 no_memory: - 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