From nobody Tue May 13 11:12:37 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 1532639557902909.9984493387956; Thu, 26 Jul 2018 14:12:37 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 19ACA32B688; Thu, 26 Jul 2018 21:12:35 +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 CE60116D21; Thu, 26 Jul 2018 21:12:34 +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 7517A4A463; Thu, 26 Jul 2018 21:12:34 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w6QLCWIJ028234 for ; Thu, 26 Jul 2018 17:12:32 -0400 Received: by smtp.corp.redhat.com (Postfix) id ADE1A63132; Thu, 26 Jul 2018 21:12:32 +0000 (UTC) Received: from mx1.redhat.com (ext-mx06.extmail.prod.ext.phx2.redhat.com [10.5.110.30]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A178661B8A for ; Thu, 26 Jul 2018 21:12:28 +0000 (UTC) Received: from mail-pg1-f194.google.com (mail-pg1-f194.google.com [209.85.215.194]) (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 9FDA4356CD for ; Thu, 26 Jul 2018 21:05:57 +0000 (UTC) Received: by mail-pg1-f194.google.com with SMTP id r5-v6so1895280pgv.0 for ; Thu, 26 Jul 2018 14:05:57 -0700 (PDT) Received: from centos.localdomain ([42.106.3.93]) by smtp.gmail.com with ESMTPSA id z10-v6sm3279182pfh.83.2018.07.26.14.05.55 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 26 Jul 2018 14:05:56 -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=P5HCJ6j7xSfuL4WFZHthJPksCRHtpZMI5YedmFa1i0M=; b=JHoPd5dlwZ/wPFZ0GdEQBV3VVDS/XvK4d1sHlgpWjzqwDVBm0GlsXaU+IqYDaUw0M/ sYpLyvaHWQodI7oYnD8EQ7xlySp7RwkMYa79cvSMNgqHQJqn1Dq2SjmXulMs7mjKRcYK qzYvGpUfCpe05Y73FsKgXQKzFoOWhAEkWa6aJCoPsmBSTqyM58o/W7kY77wHjpTxmvqv PBtTblOamusj7HsKW+jsRgPYrVwiWKAspF0SkxLdcasyLzAv50cdDHCwnOTyuP06VDS0 Tm86EE4cogp8QcMwP+nLLajpo4uWDrM/K/nzFg0F0/G8nAl1NnANTPRKjzDH+/hBvMy2 jqrA== 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=P5HCJ6j7xSfuL4WFZHthJPksCRHtpZMI5YedmFa1i0M=; b=dCg79uCYTxjctFARU+PAi1fqqoihuPKT5eaw4Kvcf/s1/0iO0N6CcvLpFXHXn/ScXw P8VW1oXJDECDuEPRdXkBdMOvZvSIAf2FrvFgQvK7OK9obYX/56h/0PHcC5areWsAmv+D dPVxiJqCX1Ove4dhMPgyKQWVIP59cNN4hD9AvdWjOBSaiTbhR2kEpLUN0YoRypcTNnkK xixicmtLtYi+bKzgJt3ZoW/jdauc8gOGXE4j+3hVwY24Cs9/up8jTnRlmuPRt27/4IYC lX1Mswq1CJ0onJFQlNvrvVsYYsyZ9UEOECfmxKwm5ebw+lw8ki6b1qefRDftey4YQN1E xmfQ== X-Gm-Message-State: AOUpUlG6tn7+g8AtFhVHAAoM4LVlvvbpinjXCkJbIEyvCGHv1SPT5u4b Oyy72H7kjItdquYRVTGca2Z8YS1h X-Google-Smtp-Source: AAOMgpcsJ0167GnrXl27WYcTZ6am/N0sTZKyl1K8LhvUk27hf8umOqa2JBYi31QSVY3Wmt+SNC8F6g== X-Received: by 2002:a63:6d8b:: with SMTP id i133-v6mr3409089pgc.215.1532639156914; Thu, 26 Jul 2018 14:05:56 -0700 (PDT) From: Sukrit Bhatnagar To: libvir-list@redhat.com Date: Tue, 24 Jul 2018 21:22:41 +0530 Message-Id: <1532447562-24010-41-git-send-email-skrtbhtngr@gmail.com> In-Reply-To: <1532447562-24010-1-git-send-email-skrtbhtngr@gmail.com> References: <1532447562-24010-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.30]); Thu, 26 Jul 2018 21:05:57 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Thu, 26 Jul 2018 21:05:57 +0000 (UTC) for IP:'209.85.215.194' DOMAIN:'mail-pg1-f194.google.com' HELO:'mail-pg1-f194.google.com' FROM:'skrtbhtngr@gmail.com' RCPT:'' X-RedHat-Spam-Score: 1.389 * (DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, RCVD_IN_SORBS_WEB, SPF_PASS) 209.85.215.194 mail-pg1-f194.google.com 209.85.215.194 mail-pg1-f194.google.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.30 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v2 40/41] 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.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Thu, 26 Jul 2018 21:12:36 +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 Reviewed-by: Erik Skultety --- 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