From nobody Sun Feb 8 14:53:09 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 1532175051985226.93827662046817; Sat, 21 Jul 2018 05:10:51 -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 E118A3082152; Sat, 21 Jul 2018 12:10:48 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A8284600C7; Sat, 21 Jul 2018 12:10:47 +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 5B8611841C6E; Sat, 21 Jul 2018 12:10:47 +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 w6LC9VsD016827 for ; Sat, 21 Jul 2018 08:09:31 -0400 Received: by smtp.corp.redhat.com (Postfix) id E33385B680; Sat, 21 Jul 2018 12:09:31 +0000 (UTC) Received: from mx1.redhat.com (ext-mx20.extmail.prod.ext.phx2.redhat.com [10.5.110.49]) by smtp.corp.redhat.com (Postfix) with ESMTPS id DB0A65B686 for ; Sat, 21 Jul 2018 12:09:10 +0000 (UTC) Received: from mail-pf1-f196.google.com (mail-pf1-f196.google.com [209.85.210.196]) (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 074A03081252 for ; Sat, 21 Jul 2018 12:09:00 +0000 (UTC) Received: by mail-pf1-f196.google.com with SMTP id e13-v6so223491pff.7 for ; Sat, 21 Jul 2018 05:08:59 -0700 (PDT) Received: from centos.localdomain ([42.106.1.69]) by smtp.gmail.com with ESMTPSA id s16-v6sm5861694pfm.114.2018.07.21.05.08.57 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 21 Jul 2018 05:08:58 -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=+S2HIATW0FYgQX2+zQWQ+/AFQQ2aCfZHBfDgE/IGu9s=; b=i7kwz8ed+X4XcQmnzQeqzHsMwueoyLq4DkoHhIXLot68P1Ke/YCz0yMp1jzcab88D0 FHGsG6dC0hKl+uM8frXRNptGitLYCsCs0ivhiZ0Ssss+W9jNunIxn3l8pYwmnkcEvd3g lQLV2+pjrjmQszJD/uVzYQ3RStJ2KU3SCDmCPr8bIj12AWxa15FFwzK+0UfFqlW1Vva0 bqpOnp+fXLMHSX48+6oUXGQTRhHrHls/ZxCt/8kOoSpW8GwXJfv5yzs3Cdo0N2F+Y/IQ fFzw8k3cVmnRzBVRKDvcfifZxbfZ9LsrQ95SaLDAGdWqJ3dSeEF4/RwBXP2s4HqTVnBR 28Kw== 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=+S2HIATW0FYgQX2+zQWQ+/AFQQ2aCfZHBfDgE/IGu9s=; b=pZjqEfpZNYDQEBPGZXz8/9ockLC8ggYRvpFd8oR/RjO6TSahak6N2DWJn2Rb0KYkyk JzkKOVHzob+Z+3Q+SJKVbCXBqhNIfd+VWoLdYFqOt0pwB/RzdHHStN38W0zo5zD7lfQM vWWWyHV6fDB3Q2HK7pYa2NNGesczsFLPXV4Yr5Q6mk0Aq1cgIbrSUAi0XklUepk9+REr 4oywgZDBZj4sqA4h5IeQxcQhNevTDMI4NPE2cvpBW5pbRGhS75V/nHd+nz7MROkYaB8+ cDAt+J+K4oi/wbVJDV9Xwz8Dmv6LVjZ6oj3wJQVTHUgyaoSz57mqe/97ARVu+KOUCmhs tV5Q== X-Gm-Message-State: AOUpUlF5At0fRijodFgwOCZWGMCWj+NHb/KaVl+vWDtJ3ro5IikiqMKu 3N1vRnWKodluZblUuczSeQuB4Ptd X-Google-Smtp-Source: AAOMgpe0w1OkRwmED3FUz8MiNp92VQh51zpZgBVMsOd0yoxAMvph7Vgh56O7KmtZsDwDaQY05Bvb0Q== X-Received: by 2002:a63:e145:: with SMTP id h5-v6mr5354405pgk.286.1532174939252; Sat, 21 Jul 2018 05:08:59 -0700 (PDT) From: Sukrit Bhatnagar To: libvir-list@redhat.com Date: Sat, 21 Jul 2018 17:37:11 +0530 Message-Id: <1532174832-21644-40-git-send-email-skrtbhtngr@gmail.com> In-Reply-To: <1532174832-21644-1-git-send-email-skrtbhtngr@gmail.com> References: <1532174832-21644-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.49]); Sat, 21 Jul 2018 12:09:00 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.49]); Sat, 21 Jul 2018 12:09:00 +0000 (UTC) for IP:'209.85.210.196' DOMAIN:'mail-pf1-f196.google.com' HELO:'mail-pf1-f196.google.com' FROM:'skrtbhtngr@gmail.com' RCPT:'' X-RedHat-Spam-Score: 1.311 * (DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, NML_ADSP_CUSTOM_MED, SPF_PASS, T_DKIM_INVALID) 209.85.210.196 mail-pf1-f196.google.com 209.85.210.196 mail-pf1-f196.google.com X-Scanned-By: MIMEDefang 2.84 on 10.5.110.49 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v1 39/40] util: lease: 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.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.42]); Sat, 21 Jul 2018 12:10:51 +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" 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 --- src/util/virlease.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/util/virlease.c b/src/util/virlease.c index b49105d..baaceaf 100644 --- a/src/util/virlease.c +++ b/src/util/virlease.c @@ -55,7 +55,7 @@ virLeaseReadCustomLeaseFile(virJSONValuePtr leases_array_= new, const char *ip_to_delete, char **server_duid) { - char *lease_entries =3D NULL; + VIR_AUTOFREE(char *) lease_entries =3D NULL; virJSONValuePtr leases_array =3D NULL; long long expirytime; int custom_lease_file_len =3D 0; @@ -146,7 +146,6 @@ virLeaseReadCustomLeaseFile(virJSONValuePtr leases_arra= y_new, =20 cleanup: virJSONValueFree(leases_array); - VIR_FREE(lease_entries); return ret; } =20 @@ -235,7 +234,7 @@ virLeaseNew(virJSONValuePtr *lease_ret, virJSONValuePtr lease_new =3D NULL; const char *exptime_tmp =3D virGetEnvAllowSUID("DNSMASQ_LEASE_EXPIRES"= ); long long expirytime =3D 0; - char *exptime =3D NULL; + VIR_AUTOFREE(char *) exptime =3D NULL; int ret =3D -1; =20 /* In case hostname is still unknown, use the last known one */ @@ -291,7 +290,6 @@ virLeaseNew(virJSONValuePtr *lease_ret, *lease_ret =3D lease_new; lease_new =3D NULL; cleanup: - VIR_FREE(exptime); virJSONValueFree(lease_new); return ret; } --=20 1.8.3.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list