From nobody Mon Dec 15 01:36:41 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 152812424388227.554678436492395; Mon, 4 Jun 2018 07:57:23 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 89EF63184B16; Mon, 4 Jun 2018 14:57:21 +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 334DE600C4; Mon, 4 Jun 2018 14:57:21 +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 9656D4BB78; Mon, 4 Jun 2018 14:57:20 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w54EbETI008550 for ; Mon, 4 Jun 2018 10:37:14 -0400 Received: by smtp.corp.redhat.com (Postfix) id A00971001941; Mon, 4 Jun 2018 14:37:14 +0000 (UTC) Received: from mx1.redhat.com (ext-mx09.extmail.prod.ext.phx2.redhat.com [10.5.110.38]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 97AFF100164D for ; Mon, 4 Jun 2018 14:37:12 +0000 (UTC) Received: from mail-pf0-f195.google.com (mail-pf0-f195.google.com [209.85.192.195]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 04E52104D69 for ; Mon, 4 Jun 2018 14:37:01 +0000 (UTC) Received: by mail-pf0-f195.google.com with SMTP id a22-v6so2951751pfo.12 for ; Mon, 04 Jun 2018 07:37:00 -0700 (PDT) Received: from centos.localdomain ([42.106.2.208]) by smtp.gmail.com with ESMTPSA id f63-v6sm23448806pfe.143.2018.06.04.07.36.58 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 04 Jun 2018 07:36:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references; bh=6xKjzNQGHnbRQnKkMV4Ohunv4lCfQRorg9r1nN8j/us=; b=T9bsC/B6Qv4qU/Blczo4/ulBYn8aP/p2VSf/IZxKDV75h4ESquW+uOIRQvs421Wcbo pI8SIbgVubfEYhICHrhes7YIqfaO3nQlM2oogXmk/94NRZFJGToSfVA4A8SNBqFdN7C3 lI2dLYWwC9uxQWaehF1hp8Or6Gg5vxTJtI61pB2DyA8Om/n3gWEB65LFp7Rmtn2gk3/i osdoZa49dPIYOJvsqxbtjquZg3hOHKwd/ZklyVjd7KWbd7ob+dIaYRv6qmTNME4dc0ph mX1S6Jb4L4muSPY+Ccmfl8Zn9HfDHhvn+n7CbUmibbrgXs1ap5i2+7xGQJY/786KNR/1 Xkug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=6xKjzNQGHnbRQnKkMV4Ohunv4lCfQRorg9r1nN8j/us=; b=mgV6K7qcBJQwVlIE11hS/LnMHiJKOWbUUen6t3fxcL9unrfe0g779ByeHR5ojUeMyV H1cm+g69o/x/JzRgkgAMyYIVkS+QkCjCiC47AzNA7/jp9xrKU+/Xu3r3MULGv/j6miu2 djfRP0tapFjj51oXHWl8AdHH1gyDsKRiTKELWuDPwweK6/PoP6As1zGIvQ5t8tmUEWpY ZNQO00HcszttmER1amYWvHJqdm9FIzeBISqV30vPXs4BQROeWGJ+Bcpc+Ka4o+RNKq3c MnS++mUJmdwoaf1u0CpEC7yNAU0lv/o7FOxRzRRvMpYahHFAxVyPi4ZkQlhCE8XdJMoJ F23w== X-Gm-Message-State: APt69E2eaJfirsv3I5jRaSs4VugjZPshlkohtxkCEVH1J9hir9s/MOyz 0rz/oY0IyF3vY0AtR2/JEVqA2N+W X-Google-Smtp-Source: ADUXVKJSb61RhzCAVIDM261aU1bvy+SuiDwAxJXlTKgAMyERBWP68tH5xULNAlBMr+/icbVZ/jz/pg== X-Received: by 2002:a62:6e01:: with SMTP id j1-v6mr4204013pfc.93.1528123020165; Mon, 04 Jun 2018 07:37:00 -0700 (PDT) From: Sukrit Bhatnagar To: libvir-list@redhat.com Date: Sun, 3 Jun 2018 13:42:15 +0530 Message-Id: <1528013536-22196-18-git-send-email-skrtbhtngr@gmail.com> In-Reply-To: <1528013536-22196-1-git-send-email-skrtbhtngr@gmail.com> References: <1528013536-22196-1-git-send-email-skrtbhtngr@gmail.com> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Mon, 04 Jun 2018 14:37:01 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Mon, 04 Jun 2018 14:37:01 +0000 (UTC) for IP:'209.85.192.195' DOMAIN:'mail-pf0-f195.google.com' HELO:'mail-pf0-f195.google.com' FROM:'skrtbhtngr@gmail.com' RCPT:'' X-RedHat-Spam-Score: 0.991 (DATE_IN_PAST_24_48, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, NML_ADSP_CUSTOM_MED, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_PASS, T_DKIM_INVALID) 209.85.192.195 mail-pf0-f195.google.com 209.85.192.195 mail-pf0-f195.google.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.38 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v1 17/18] use VIR_AUTOFREE in src/util/virfirewall.c 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: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.41]); Mon, 04 Jun 2018 14:57:22 +0000 (UTC) X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Modify code to use VIR_AUTOFREE macro wherever required. Signed-off-by: Sukrit Bhatnagar --- src/util/virfirewall.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/src/util/virfirewall.c b/src/util/virfirewall.c index 10c370a..568612c 100644 --- a/src/util/virfirewall.c +++ b/src/util/virfirewall.c @@ -512,7 +512,7 @@ void virFirewallRuleAddArgFormat(virFirewallPtr firewal= l, virFirewallRulePtr rule, const char *fmt, ...) { - char *arg; + VIR_AUTOFREE(char *) arg =3D NULL; va_list list; =20 VIR_FIREWALL_RULE_RETURN_IF_ERROR(firewall, rule); @@ -526,13 +526,11 @@ void virFirewallRuleAddArgFormat(virFirewallPtr firew= all, =20 va_end(list); =20 - VIR_FREE(arg); return; =20 no_memory: firewall->err =3D ENOMEM; va_end(list); - VIR_FREE(arg); } =20 =20 @@ -679,7 +677,7 @@ virFirewallApplyRuleDirect(virFirewallRulePtr rule, virCommandPtr cmd =3D NULL; int status; int ret =3D -1; - char *error =3D NULL; + VIR_AUTOFREE(char *) error =3D NULL; =20 if (!bin) { virReportError(VIR_ERR_INTERNAL_ERROR, @@ -715,7 +713,6 @@ virFirewallApplyRuleDirect(virFirewallRulePtr rule, =20 ret =3D 0; cleanup: - VIR_FREE(error); virCommandFree(cmd); return ret; } @@ -808,12 +805,11 @@ virFirewallApplyRule(virFirewallPtr firewall, virFirewallRulePtr rule, bool ignoreErrors) { - char *output =3D NULL; + VIR_AUTOFREE(char *) output =3D NULL; char **lines =3D NULL; int ret =3D -1; - char *str =3D virFirewallRuleToString(rule); + VIR_AUTOFREE(char *) str =3D virFirewallRuleToString(rule); VIR_INFO("Applying rule '%s'", NULLSTR(str)); - VIR_FREE(str); =20 if (rule->ignoreErrors) ignoreErrors =3D rule->ignoreErrors; @@ -858,7 +854,6 @@ virFirewallApplyRule(virFirewallPtr firewall, ret =3D 0; cleanup: virStringListFree(lines); - VIR_FREE(output); return ret; } =20 --=20 1.8.3.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list