From nobody Mon Feb 9 00:07:00 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1624021525; cv=none; d=zohomail.com; s=zohoarc; b=DmsSc1Q+yhYsoSPatMsbSfXkJvPk9fwXG4hS74UwFd+Pv/FB2aSwfG9bW6TAFVVv/2xA32vNCZp1sU0ajCk991rRWpRbEHD95TWFMAwPhMBng+y7uiLSoenyGDxZMFRC8ftVEvOvAFiwSSqHZbuU384KxzLnEurXDmuoMLIj0eg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1624021525; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=vvERl38SF4TGFLiJSDYvH54Gyr8jJjyXNPcRMN2TwYY=; b=baCWrzWHxuJn6ZaXZkeykgfA158bjZWA99SEiTd7wBRElnkcRMgPd1HkzeqhZlsVjKGfW+ca9Hmr8WQrkJyKl1nManeRQa111osnI+cuqE44a4VhdhaCcjy58akB394tkmf5k41i8hnXKj7vlbI1ycznm79fO2LLbsNNPEafBxk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1624021525148923.1347755169053; Fri, 18 Jun 2021 06:05:25 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-385-AtpoXgyTNyS2oER2LY5c-Q-1; Fri, 18 Jun 2021 09:05:22 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B5C6D100B3B2; Fri, 18 Jun 2021 13:05:16 +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 92DAE5C224; Fri, 18 Jun 2021 13:05:16 +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 3CBCE46F5D; Fri, 18 Jun 2021 13:05:16 +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 15ID4wfN032751 for ; Fri, 18 Jun 2021 09:04:58 -0400 Received: by smtp.corp.redhat.com (Postfix) id 8F5D35C233; Fri, 18 Jun 2021 13:04:58 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.40.208.13]) by smtp.corp.redhat.com (Postfix) with ESMTP id EA1065C224 for ; Fri, 18 Jun 2021 13:04:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1624021524; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=vvERl38SF4TGFLiJSDYvH54Gyr8jJjyXNPcRMN2TwYY=; b=LOR2LH0I27qQ3MxfpIWcvgZmpdhrULo4qRIS2Oh+Up98UWHvj4reVeWufF2VpVVBufifef wYQ6cIOrqfJTmcIlS4fW2gTQSGxHgR1a45r7t7lP2NGelmAg5yIEA11i+YOiB41i7es9pD saTanEJLYw3jSmUoxbRWQxS9IIH946E= X-MC-Unique: AtpoXgyTNyS2oER2LY5c-Q-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 4/4] virStorageBackendISCSIDirectFindPoolSources: Rework cleanup Date: Fri, 18 Jun 2021 15:04:49 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" virISCSIDirectScanTargets now returns a GStrv, so we can use automatic cleanup for it and get rid of the cleanup section. Signed-off-by: Peter Krempa --- src/storage/storage_backend_iscsi_direct.c | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/src/storage/storage_backend_iscsi_direct.c b/src/storage/stora= ge_backend_iscsi_direct.c index 2073a6df38..b108b12f7b 100644 --- a/src/storage/storage_backend_iscsi_direct.c +++ b/src/storage/storage_backend_iscsi_direct.c @@ -485,8 +485,7 @@ virStorageBackendISCSIDirectFindPoolSources(const char = *srcSpec, unsigned int flags) { size_t ntargets =3D 0; - char **targets =3D NULL; - char *ret =3D NULL; + g_auto(GStrv) targets =3D NULL; size_t i; g_autoptr(virStoragePoolSourceList) list =3D g_new0(virStoragePoolSour= ceList, 1); g_autofree char *portal =3D NULL; @@ -508,20 +507,20 @@ virStorageBackendISCSIDirectFindPoolSources(const cha= r *srcSpec, if (source->nhost !=3D 1) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("Expected exactly 1 host for the storage pool")); - goto cleanup; + return NULL; } if (!source->initiator.iqn) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("missing initiator IQN")); - goto cleanup; + return NULL; } if (!(portal =3D virStorageBackendISCSIDirectPortal(source))) - goto cleanup; + return NULL; if (virISCSIDirectScanTargets(source->initiator.iqn, portal, &ntargets= , &targets) < 0) - goto cleanup; + return NULL; list->sources =3D g_new0(virStoragePoolSource, ntargets); @@ -541,14 +540,7 @@ virStorageBackendISCSIDirectFindPoolSources(const char= *srcSpec, list->nsources++; } - if (!(ret =3D virStoragePoolSourceListFormat(list))) - goto cleanup; - - cleanup: - for (i =3D 0; i < ntargets; i++) - VIR_FREE(targets[i]); - VIR_FREE(targets); - return ret; + return virStoragePoolSourceListFormat(list); } static struct iscsi_context * --=20 2.31.1