From nobody Mon Feb 9 12:09:06 2026 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 1533714250584755.5138059443603; Wed, 8 Aug 2018 00:44:10 -0700 (PDT) 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 mx1.redhat.com (Postfix) with ESMTPS id 805C48F242; Wed, 8 Aug 2018 07:44:07 +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 4C001608EE; Wed, 8 Aug 2018 07:44:07 +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 8475124F56; Wed, 8 Aug 2018 07:44:06 +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 w787i4fd005825 for ; Wed, 8 Aug 2018 03:44:04 -0400 Received: by smtp.corp.redhat.com (Postfix) id B0D7317D2F; Wed, 8 Aug 2018 07:44:04 +0000 (UTC) Received: from mx1.redhat.com (ext-mx15.extmail.prod.ext.phx2.redhat.com [10.5.110.44]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A52F062929 for ; Wed, 8 Aug 2018 07:43:54 +0000 (UTC) Received: from mail-pf1-f175.google.com (mail-pf1-f175.google.com [209.85.210.175]) (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 DD73A30832F3 for ; Wed, 8 Aug 2018 07:43:53 +0000 (UTC) Received: by mail-pf1-f175.google.com with SMTP id u24-v6so700937pfn.13 for ; Wed, 08 Aug 2018 00:43:53 -0700 (PDT) Received: from centos.localdomain ([42.106.0.165]) by smtp.gmail.com with ESMTPSA id 9-v6sm9617719pfv.53.2018.08.08.00.43.51 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 08 Aug 2018 00:43:52 -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=UwN+DR+B+ttsQZjpRoVS5YvanlWgAOgJBbeG2Z1vJNQ=; b=KlV7YQOWUZOf7fhunAWg5jC1Clv6XTe48Xl/0K+RLqWfnc2OH+LcLu9kdykJGXdhuS GH8UQ/z+MFWgWPmz/GbXz4jeg+WLv7IiLt5GqRTPj49fcKIdDS6y7r4n0Ri8Ix6iZ28I bzerjrmDbaiIYGCdx7yFXuysLG0dqawQA/zvlSPbu1HQH6EnW+Ve6W6kBzjy25dEFa6w 25XvpjMMjNQXK6/A+aURGgdEy5mMqkafmS84j0E+OxG8bwY69upTHrKN57kqn/pIZ4ZW kM0Vz0Yn81q8tNw1I+2B5sVOau+gsgJLRXHOOFsxOoZJ/wnOTuFHxbGqlF1pZnI+ZVVb lYfw== 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=UwN+DR+B+ttsQZjpRoVS5YvanlWgAOgJBbeG2Z1vJNQ=; b=MpceGkJKwThvtlpk5IV/HwydziBnjHqtVgydya5w3GALgt+FRywSivyHaKe4nPyWnb RX4J2UYzZ59AshDbuCJ1weJ8V75bthaITVMFH0YrCgZJBv9b5fJHNK+PCD9Xa1e3E09c dfmHk9LK4BzZXgmNVcuk1DB6+3Z+GGM4dBYcMmJ/qf2mkEWEayEsGcjCLAObzvRrXSBi sVL3TMFtXfFQHxs5HkywjtV9/F9/nU+RFg0HlwoQhEkjCdHIz3n65IPFRoqcbVhdsFiw VZm9V0kFrcaMdzLJ50XrXfnmfLOjYUZn8O2pZgN82vlS+eoDJQiEgbw2nR/OgFgpx34Y lEbw== X-Gm-Message-State: AOUpUlEL+VrPUQ8CctaUFek4iD3PokSb48YGgNBpcimTFo1KDchqIk3Q NG/IZ3yTr175yAAdsGgqIKwe2NWl X-Google-Smtp-Source: AA+uWPz0UBJpJZ2B2KfOdFQ+FzRAJ7I6SgEi6wtblw+GwwEW36G8SQ8F5E7BraP0+yF31x8hMAa3Lw== X-Received: by 2002:a63:4703:: with SMTP id u3-v6mr1402045pga.405.1533714233174; Wed, 08 Aug 2018 00:43:53 -0700 (PDT) From: Sukrit Bhatnagar To: libvir-list@redhat.com Date: Mon, 6 Aug 2018 02:13:47 +0530 Message-Id: <1533501842-24503-21-git-send-email-skrtbhtngr@gmail.com> In-Reply-To: <1533501842-24503-1-git-send-email-skrtbhtngr@gmail.com> References: <1533501842-24503-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.44]); Wed, 08 Aug 2018 07:43:53 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Wed, 08 Aug 2018 07:43:53 +0000 (UTC) for IP:'209.85.210.175' DOMAIN:'mail-pf1-f175.google.com' HELO:'mail-pf1-f175.google.com' FROM:'skrtbhtngr@gmail.com' RCPT:'' X-RedHat-Spam-Score: -0.111 (DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_PASS) 209.85.210.175 mail-pf1-f175.google.com 209.85.210.175 mail-pf1-f175.google.com X-Scanned-By: MIMEDefang 2.84 on 10.5.110.44 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v2 20/35] util: netdevmacvlan: use VIR_AUTOFREE instead of VIR_FREE for scalar types 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.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Wed, 08 Aug 2018 07:44:09 +0000 (UTC) X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDMRC_1 RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" By making use of GNU C's cleanup attribute handled by the VIR_AUTOFREE macro for declaring scalar variables, majority of the VIR_FREE calls can be dropped, which in turn leads to getting rid of most of our cleanup sections. Signed-off-by: Sukrit Bhatnagar Reviewed-by: Erik Skultety --- src/util/virnetdevmacvlan.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/util/virnetdevmacvlan.c b/src/util/virnetdevmacvlan.c index 91c6244..a2ed65c 100644 --- a/src/util/virnetdevmacvlan.c +++ b/src/util/virnetdevmacvlan.c @@ -308,7 +308,7 @@ virNetDevMacVLanCreate(const char *ifname, int *retry) { int rc =3D -1; - struct nlmsghdr *resp =3D NULL; + VIR_AUTOFREE(struct nlmsghdr *) resp =3D NULL; struct nlmsgerr *err; struct ifinfomsg ifinfo =3D { .ifi_family =3D AF_UNSPEC }; int ifindex; @@ -403,7 +403,6 @@ virNetDevMacVLanCreate(const char *ifname, rc =3D 0; cleanup: nlmsg_free(nl_msg); - VIR_FREE(resp); return rc; =20 malformed_resp: @@ -452,7 +451,7 @@ virNetDevMacVLanTapOpen(const char *ifname, { int ret =3D -1; int ifindex; - char *tapname =3D NULL; + VIR_AUTOFREE(char *) tapname =3D NULL; size_t i =3D 0; =20 if (virNetDevGetIndex(ifname, &ifindex) < 0) @@ -487,7 +486,6 @@ virNetDevMacVLanTapOpen(const char *ifname, while (i--) VIR_FORCE_CLOSE(tapfd[i]); } - VIR_FREE(tapname); return ret; } =20 --=20 1.8.3.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list