From nobody Wed May 14 01:24:23 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 1528124235030485.21524830938233; Mon, 4 Jun 2018 07:57:15 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.25]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7AAA53184409; Mon, 4 Jun 2018 14:57:11 +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 9A1562010CC7; Mon, 4 Jun 2018 14:57:10 +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 77E091804480; Mon, 4 Jun 2018 14:57:07 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w54Easf5008130 for ; Mon, 4 Jun 2018 10:36:54 -0400 Received: by smtp.corp.redhat.com (Postfix) id 41EB98B327; Mon, 4 Jun 2018 14:36:54 +0000 (UTC) Received: from mx1.redhat.com (ext-mx10.extmail.prod.ext.phx2.redhat.com [10.5.110.39]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3ABB99BA51 for ; Mon, 4 Jun 2018 14:36:54 +0000 (UTC) Received: from mail-pl0-f66.google.com (mail-pl0-f66.google.com [209.85.160.66]) (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 9BEA3169380 for ; Mon, 4 Jun 2018 14:36:42 +0000 (UTC) Received: by mail-pl0-f66.google.com with SMTP id n10-v6so19840721plp.0 for ; Mon, 04 Jun 2018 07:36:42 -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.40 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 04 Jun 2018 07:36:41 -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=pX9ItnH7XnkncjcyWfiDUOGBUi396SMT1pekT5X9KH4=; b=MUAuD91EgK1jBbbAxX1S6bJU8IVOhv41mIXib7hqaXL4FsM7Xq+Ply+nNk4/4kr9aM wiLX0N3Ey6oubKsury38ZXM9ANGnaevAbdDPul2JDrE9KDVTET9NImVhXco4NXm4bzRQ BBncop4ExSu4EkMdd+lb5LhHmqWxL/aILe1Dcp6ApXy2yuPZVRwYJRl2h4JgSUOQDS8f 8vCv1kM+NYoCWPA+8Qulz+XWUlQv0GIpIMz+SlQMguq38S9VSYstKuu5D9Kf7cQz9wYS cCulRjUbW77gq/yQdyn9dhjXi8nXP/KLt4gk7rq+MOoikGx0AcR9KK4k2hdS1YzwYP6a YBeQ== 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=pX9ItnH7XnkncjcyWfiDUOGBUi396SMT1pekT5X9KH4=; b=tAUc8aVDHb1F8MNbKQTrSM/N/yl5v8D4g0+Xuo639ncoyttSoNSD1f3YjABzr3oUA9 +cBShzmf6b6y1ORK1l6I0mCs4vlfiRBoCWfcIDQ4f79RoPcwkT1vOEeBnlI4ZwY6kbZ7 qPYskOWXoNdxApfBwq9MIQ8ZgFOBfbDl1dbV0fyzP/9dKB1S4tMO/aZcadLYA0cwwPVQ 2xQO9yHQ45WQPVAiO7ckLvvMkMJrcapL1q1+z8PPuHbIz7Gcm/KeRmkA5jhIO+eQMvXn Q0QU/Wk4BtmaAyvwBLPeYB0g/AcNdAbXsonOAqnhtxJ35Q6s2TvZ9+d7hB/Du1hSYDeq kCfg== X-Gm-Message-State: APt69E1Mcdf/k9IMYopcxmBbMjuvFg64XDnhl1ZuzJdfpejq9yz+5Dvq 1zuQY/+Z/x6CyKx9/zfZW/OcmeJt X-Google-Smtp-Source: ADUXVKIWDSHJ0brSJSXpRaJbOniRjA0FHNBkmucOaYm+QQbgn1fG3Nv6NbJ/t1Ymu0z9INawtUB4DA== X-Received: by 2002:a17:902:2869:: with SMTP id e96-v6mr8760818plb.58.1528123001812; Mon, 04 Jun 2018 07:36:41 -0700 (PDT) From: Sukrit Bhatnagar To: libvir-list@redhat.com Date: Sun, 3 Jun 2018 13:42:07 +0530 Message-Id: <1528013536-22196-10-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.39]); Mon, 04 Jun 2018 14:36:42 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Mon, 04 Jun 2018 14:36:42 +0000 (UTC) for IP:'209.85.160.66' DOMAIN:'mail-pl0-f66.google.com' HELO:'mail-pl0-f66.google.com' FROM:'skrtbhtngr@gmail.com' RCPT:'' X-RedHat-Spam-Score: 1.766 * (DATE_IN_PAST_24_48, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, NML_ADSP_CUSTOM_MED, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_PASS, T_DKIM_INVALID) 209.85.160.66 mail-pl0-f66.google.com 209.85.160.66 mail-pl0-f66.google.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.39 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.27 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v1 09/18] use VIR_AUTOFREE in src/util/virfcp.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.84 on 10.5.11.25 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:13 +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/virfcp.c | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/src/util/virfcp.c b/src/util/virfcp.c index 7660ba7..b703744 100644 --- a/src/util/virfcp.c +++ b/src/util/virfcp.c @@ -40,16 +40,12 @@ bool virFCIsCapableRport(const char *rport) { - bool ret =3D false; - char *path =3D NULL; + VIR_AUTOFREE(char *) path =3D NULL; =20 if (virBuildPath(&path, SYSFS_FC_RPORT_PATH, rport) < 0) return false; =20 - ret =3D virFileExists(path); - VIR_FREE(path); - - return ret; + return virFileExists(path); } =20 int @@ -57,8 +53,8 @@ virFCReadRportValue(const char *rport, const char *entry, char **result) { - int ret =3D -1; - char *buf =3D NULL, *p =3D NULL; + VIR_AUTOFREE(char *) buf =3D NULL; + char *p =3D NULL; =20 if (virFileReadValueString(&buf, "%s/%s/%s", SYSFS_FC_RPORT_PATH, rport, entry) < 0) { @@ -69,13 +65,9 @@ virFCReadRportValue(const char *rport, *p =3D '\0'; =20 if (VIR_STRDUP(*result, buf) < 0) - goto cleanup; - - ret =3D 0; + return -1; =20 - cleanup: - VIR_FREE(buf); - return ret; + return 0; } =20 #else --=20 1.8.3.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list