From nobody Wed May 14 01:28:48 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 1528124503118767.6701127205044; Mon, 4 Jun 2018 08:01:43 -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 0B46F2ED2DE; Mon, 4 Jun 2018 15:01:41 +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 9B4AD5F7C2; Mon, 4 Jun 2018 15:01:40 +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 89C621800FC1; Mon, 4 Jun 2018 15:01:39 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w54EbFJd008555 for ; Mon, 4 Jun 2018 10:37:15 -0400 Received: by smtp.corp.redhat.com (Postfix) id 5A41720155E3; Mon, 4 Jun 2018 14:37:15 +0000 (UTC) Received: from mx1.redhat.com (ext-mx13.extmail.prod.ext.phx2.redhat.com [10.5.110.42]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 442312007836 for ; Mon, 4 Jun 2018 14:37:15 +0000 (UTC) Received: from mail-pf0-f193.google.com (mail-pf0-f193.google.com [209.85.192.193]) (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 2D30730D0CF6 for ; Mon, 4 Jun 2018 14:37:04 +0000 (UTC) Received: by mail-pf0-f193.google.com with SMTP id x9-v6so16149726pfm.2 for ; Mon, 04 Jun 2018 07:37:04 -0700 (PDT) Received: from centos.localdomain ([42.106.2.208]) by smtp.gmail.com with ESMTPSA id f63-v6sm23448806pfe.143.2018.06.04.07.37.00 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 04 Jun 2018 07:37:02 -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=AZ/VlMrl1x50e2ErqRGlRZCTSTohm4SeznC1eKuoMn8=; b=T7oZ0/6mt0uBgyLZrfm87QiDChxoncN9zqpOs9HjsQbUgO5MdEgtRUgcfOloavhzLh gonVFqKS89Abn0OcsGHlds1oD4ARW6BHoTTCco9cST6eneLPi2ECwgg38BzIdePOs0au 7Pc6YolC3cp1gkzRH5uA5muOthqP5KWDXEfrYCdIcM+4WwKV5kbRzbPYYImJv9t0HY/X o8XEhTpAEs9kQ5R7HW6ZG+Hc6S13wVbNFMZEB31GmoWvYQWOn9uOx/nrcHqKXT1bPoAS MHOU+chMYxFsz/yGBmi1u16DS07Z4vPFAgNbGBhAxJi4XY3FfWpyZX3Lfrjux8pfe1I5 9erA== 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=AZ/VlMrl1x50e2ErqRGlRZCTSTohm4SeznC1eKuoMn8=; b=KERHk46vzZVYqHoPPPxOkY+zbrQkeajUDVI2Eefgidc/IeDPZ2kg2H8WQrSFhkkjG1 PIKiwGT8kDpik2/jEQApXInzYl215+JioUTq7FQJsNcgguDikJReLrS/o7b9JrQjhBCw OZQJe4PFnH4MV48ZHM/zQFQYhCY4uoNEpnmFHk8tqNn3JPJF4Xfrx8kjQ+ZeKMMeES3Y QFeQLbvWuUfSq13DAOS4lX3or/wKo8ALtv+9+KeLdiILtKcUGXlA8cUoMhtL5qA9TJil QLWcGr4svIpBdA0alsFPQsZMjXYbvg9w6u7RXHX1A92Wx1cX2FWQKDTvI5ZzcsGmzs98 IhSA== X-Gm-Message-State: APt69E07cqUH8U8H5tW3kniMAhpNBW+HN8c0hj5oHfgq+DiYGA42QMtG hkdWBgrTBLv/TbwvDjanCH+Wksz1 X-Google-Smtp-Source: ADUXVKL+a3hm2yhgtkD+YoahCXm+kzmAnXJeKl9CyXsModm2QFSSPYy/c+bx+sYKSAl9wzDcRYUWHA== X-Received: by 2002:a63:bf0b:: with SMTP id v11-v6mr4271060pgf.29.1528123023186; Mon, 04 Jun 2018 07:37:03 -0700 (PDT) From: Sukrit Bhatnagar To: libvir-list@redhat.com Date: Sun, 3 Jun 2018 13:42:16 +0530 Message-Id: <1528013536-22196-19-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.42]); Mon, 04 Jun 2018 14:37:04 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.42]); Mon, 04 Jun 2018 14:37:04 +0000 (UTC) for IP:'209.85.192.193' DOMAIN:'mail-pf0-f193.google.com' HELO:'mail-pf0-f193.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.193 mail-pf0-f193.google.com 209.85.192.193 mail-pf0-f193.google.com X-Scanned-By: MIMEDefang 2.84 on 10.5.110.42 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.25 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v1 18/18] use VIR_AUTOFREE in src/util/virhook.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.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Mon, 04 Jun 2018 15:01:42 +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/virhook.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/src/util/virhook.c b/src/util/virhook.c index facd74a..51f0eb5 100644 --- a/src/util/virhook.c +++ b/src/util/virhook.c @@ -122,8 +122,7 @@ static int virHooksFound =3D -1; static int virHookCheck(int no, const char *driver) { - char *path; - int ret; + VIR_AUTOFREE(char *) path =3D NULL; =20 if (driver =3D=3D NULL) { virReportError(VIR_ERR_INTERNAL_ERROR, @@ -139,18 +138,15 @@ virHookCheck(int no, const char *driver) } =20 if (!virFileExists(path)) { - ret =3D 0; VIR_DEBUG("No hook script %s", path); + return 0; } else if (!virFileIsExecutable(path)) { - ret =3D 0; VIR_WARN("Non-executable hook script %s", path); + return 0; } else { - ret =3D 1; VIR_DEBUG("Found hook script %s", path); + return 1; } - - VIR_FREE(path); - return ret; } =20 /* @@ -233,7 +229,7 @@ virHookCall(int driver, char **output) { int ret; - char *path; + VIR_AUTOFREE(char *) path =3D NULL; virCommandPtr cmd; const char *drvstr; const char *opstr; @@ -318,7 +314,5 @@ virHookCall(int driver, =20 virCommandFree(cmd); =20 - VIR_FREE(path); - return ret; } --=20 1.8.3.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list