From nobody Wed Jul 16 12:52:26 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 1533817990562284.47794795792777; Thu, 9 Aug 2018 05:33:10 -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 06DA1308214F; Thu, 9 Aug 2018 12:33:08 +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 C22FC2010CCC; Thu, 9 Aug 2018 12:33: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 7565518037F1; Thu, 9 Aug 2018 12:33:07 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w79CWpKx000393 for ; Thu, 9 Aug 2018 08:32:51 -0400 Received: by smtp.corp.redhat.com (Postfix) id C694D60C11; Thu, 9 Aug 2018 12:32:51 +0000 (UTC) Received: from mx1.redhat.com (ext-mx17.extmail.prod.ext.phx2.redhat.com [10.5.110.46]) by smtp.corp.redhat.com (Postfix) with ESMTPS id BD55F60A9E for ; Thu, 9 Aug 2018 12:32:49 +0000 (UTC) Received: from mail-pl0-f54.google.com (mail-pl0-f54.google.com [209.85.160.54]) (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 529FC300174D for ; Thu, 9 Aug 2018 12:32:48 +0000 (UTC) Received: by mail-pl0-f54.google.com with SMTP id j8-v6so2494151pll.12 for ; Thu, 09 Aug 2018 05:32:48 -0700 (PDT) Received: from centos.localdomain ([49.33.163.55]) by smtp.gmail.com with ESMTPSA id j15-v6sm8649810pfn.52.2018.08.09.05.32.46 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 09 Aug 2018 05:32:47 -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=IAFar5sqtQrMVCQwysqlH0F1aYxj1WLkhCIbAODATZs=; b=k9I1FIKFM59kD5N5mPA1vc3z+7EeUn7vb0ruONGgakjuSy61OF21DtmDIfl9t0lNkY 4ggdbGE9RQqrhFuiXojzSMcYxE+pQtqoa5+yuU0hRwZzrNx8evPthV8ADtjDr2Wj0nEA LHk7aV9UqIo/g/U4nMFaW4ZHid4pcfsX9+nXfmQyfrKJu5U1akFOhkP6OcliarIfm/rI 6Sbh4XTMsIAT/YAmt1nvz0iHc52Cz7/EXgZeXOEihYalCbuW8g0ufE7H4v1VhpoUfQ8+ lelCN0oc8cqK3wW5xyGd9oZVboMfrN5Ov32kBhFit8ERWBrzwfzOmeOMknlRDPlW/Tc3 Jz3A== 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=IAFar5sqtQrMVCQwysqlH0F1aYxj1WLkhCIbAODATZs=; b=hQUyA417oe136W/87sgWwP3fBweu0KOYHEIEzVIMASZiHqLOhNqsmmNIR/oG3kiO24 rUFWQU5WbS4JH9WR3CewPzkBJpmMWOMBYivksaRkRxTlLilwG1QEcYNxf/5euUwilo5e TVyJV9KHzYafKTX0Ke+sn9VZgmoEavwe6iOaS3sldncuakspCtTviA+kHXz5zFBTuxXt msMd+LjnLXjsHQhd3yzAK7x1yGW8lAX0E1glkluJ7/7xfxMTsHZPvVWx0NRivUk0Exvh OSj0KgWXwfoFQZlGYBBNMChYwerdBUXyRJYhu/G5pMrkQSbjrMBvGI3I2RsfkW9PC7E+ I2Iw== X-Gm-Message-State: AOUpUlFUs58SzXImiBOk7Yfxd/o41dKxrVhbZ4rbS1byIjxRJKGupGKX LE3J17NCqRg6Y4Xlin5mrENJKWzY X-Google-Smtp-Source: AA+uWPxIZt+rH2yI1irgeOUAlNqvXyFT2WZO1LHL95i5lUcIZr6tIaHHWffJAMMvYlpI7bdMBHdymw== X-Received: by 2002:a17:902:1703:: with SMTP id i3-v6mr1884002pli.263.1533817967559; Thu, 09 Aug 2018 05:32:47 -0700 (PDT) From: Sukrit Bhatnagar To: libvir-list@redhat.com Date: Thu, 9 Aug 2018 09:42:09 +0530 Message-Id: <1533787939-28634-2-git-send-email-skrtbhtngr@gmail.com> In-Reply-To: <1533787939-28634-1-git-send-email-skrtbhtngr@gmail.com> References: <1533787939-28634-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.46]); Thu, 09 Aug 2018 12:32:48 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.46]); Thu, 09 Aug 2018 12:32:48 +0000 (UTC) for IP:'209.85.160.54' DOMAIN:'mail-pl0-f54.google.com' HELO:'mail-pl0-f54.google.com' FROM:'skrtbhtngr@gmail.com' RCPT:'' X-RedHat-Spam-Score: 0.993 (DATE_IN_PAST_06_12, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, SPF_PASS) 209.85.160.54 mail-pl0-f54.google.com 209.85.160.54 mail-pl0-f54.google.com X-Scanned-By: MIMEDefang 2.84 on 10.5.110.46 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v3 01/11] util: iscsi: 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.25 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.42]); Thu, 09 Aug 2018 12:33:08 +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" Add another usage for VIR_AUTOFREE macro which was left in the commit ec3e878, thereby dropping a VIR_FREE call and and a cleanup section. Signed-off-by: Sukrit Bhatnagar Reviewed-by: Erik Skultety --- src/util/viriscsi.c | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/src/util/viriscsi.c b/src/util/viriscsi.c index c805ffc..cf07968 100644 --- a/src/util/viriscsi.c +++ b/src/util/viriscsi.c @@ -208,9 +208,10 @@ static int virStorageBackendCreateIfaceIQN(const char *initiatoriqn, char **ifacename) { - int ret =3D -1, exitstatus =3D -1; + int exitstatus =3D -1; + VIR_AUTOPTR(virCommand) cmd =3D NULL; + VIR_AUTOFREE(char *) iface_name =3D NULL; VIR_AUTOFREE(char *) temp_ifacename =3D NULL; - VIR_AUTOPTR(virCommand) cmd =3D NULL; =20 if (virAsprintf(&temp_ifacename, "libvirt-iface-%08llx", @@ -233,7 +234,7 @@ virStorageBackendCreateIfaceIQN(const char *initiatoriq= n, virReportError(VIR_ERR_INTERNAL_ERROR, _("Failed to run command '%s' to create new iscsi i= nterface"), ISCSIADM); - goto cleanup; + return -1; } virCommandFree(cmd); =20 @@ -252,26 +253,23 @@ virStorageBackendCreateIfaceIQN(const char *initiator= iqn, virReportError(VIR_ERR_INTERNAL_ERROR, _("Failed to run command '%s' to update iscsi inter= face with IQN '%s'"), ISCSIADM, initiatoriqn); - goto cleanup; + return -1; } =20 /* Check again to make sure the interface was created. */ - if (virStorageBackendIQNFound(initiatoriqn, ifacename) !=3D IQN_FOUND)= { + if (virStorageBackendIQNFound(initiatoriqn, &iface_name) !=3D IQN_FOUN= D) { VIR_DEBUG("Failed to find interface '%s' with IQN '%s' " "after attempting to create it", &temp_ifacename[0], initiatoriqn); - goto cleanup; + return -1; } else { VIR_DEBUG("Interface '%s' with IQN '%s' was created successfully", - *ifacename, initiatoriqn); + iface_name, initiatoriqn); } =20 - ret =3D 0; + VIR_STEAL_PTR(*ifacename, iface_name); =20 - cleanup: - if (ret !=3D 0) - VIR_FREE(*ifacename); - return ret; + return 0; } =20 =20 --=20 1.8.3.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list