From nobody Tue May 7 03:14:40 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.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 63.128.21.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=1601982928; cv=none; d=zohomail.com; s=zohoarc; b=O2YnHEfko8WWehg3ZLKtMhCORWf1vfWZazQKE4H8I//bJ/jNC+96/yjsUgf7/IrZRyLwe/b40kDKRJySFTnTyi/E755KvxAeGvR+XXPSiaUKhjop5wEuKuP6A1GS7I1m+lWfiZ+WZ0H35pUGuEMnFc4Rh+wkRmAstuBukUT9RX8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1601982928; h=Content-Type:Content-Transfer-Encoding:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=0XCJsnJphefCeZ9In50mvuoOgzvdEqJw1qduuV0eb3E=; b=bxMQHTPRMN0qGnZKQpPfM1pYqHVSsdIP5qBbhL9jGCHznlsIUdymwQMtxFFOfeen2brCcPHW+Q3hko5OnL9yxnSYSe7qbx3Zt3bb2RbW/NXUV8mh5DLy44oNnpW+0Mqsh5CO7s3v1Nqjv7PdgCMp9QyrDiDnMENeCeyNmKNN4dA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 1601982928326399.7699593251382; Tue, 6 Oct 2020 04:15:28 -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-198--Pscs_iIPW2R8QTJzm3dCg-1; Tue, 06 Oct 2020 07:15:23 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 4AA6A1015CA6; Tue, 6 Oct 2020 11:15:18 +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 2A1F478800; Tue, 6 Oct 2020 11:15:18 +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 C1F1044A7A; Tue, 6 Oct 2020 11:15:17 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 096BFFLZ015730 for ; Tue, 6 Oct 2020 07:15:15 -0400 Received: by smtp.corp.redhat.com (Postfix) id 4708A5D9CD; Tue, 6 Oct 2020 11:15:15 +0000 (UTC) Received: from lpt.redhat.com (unknown [10.43.2.94]) by smtp.corp.redhat.com (Postfix) with ESMTP id C42125D9EF for ; Tue, 6 Oct 2020 11:15:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1601982926; 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:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=0XCJsnJphefCeZ9In50mvuoOgzvdEqJw1qduuV0eb3E=; b=PJYbZ7DKqLgtmRAPEvNUTpva0CfFm3emLAGI1vIEH2vg+Ty9tu1rN8f+W9LJfoO5JqdCDw qGlkqN5rYipWz22Wym8nXoKGtwonir0wGJXUHuo7xFcNVgJRQvR52gXesELJ5F4hynajRE zwEDY3gj2AxGpMKzBAAKU57wAjW1PN4= X-MC-Unique: -Pscs_iIPW2R8QTJzm3dCg-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH] Fix incorrect g_new0 conversions Date: Tue, 6 Oct 2020 13:15:01 +0200 Message-Id: <7c58c485e5fcbc6c3ee6eb3b6b222ab83b56a869.1601982893.git.jtomko@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 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.11 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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) I left in a 'return' or 'goto cleanup' in a few places that where I did the conversion manually. Signed-off-by: J=C3=A1n Tomko Reported-by: John Ferlan Reviewed-by: John Ferlan --- src/esx/esx_storage_backend_vmfs.c | 1 - src/libxl/libxl_capabilities.c | 2 -- src/libxl/libxl_driver.c | 1 - src/qemu/qemu_hotplug.c | 1 - src/storage/storage_backend_iscsi_direct.c | 1 - tools/virt-login-shell-helper.c | 1 - 6 files changed, 7 deletions(-) diff --git a/src/esx/esx_storage_backend_vmfs.c b/src/esx/esx_storage_backe= nd_vmfs.c index e397853bf7..c7a7863a61 100644 --- a/src/esx/esx_storage_backend_vmfs.c +++ b/src/esx/esx_storage_backend_vmfs.c @@ -1195,7 +1195,6 @@ esxStorageVolCreateXMLFrom(virStoragePoolPtr pool, =20 if (priv->primary->hasQueryVirtualDiskUuid) { key =3D g_new0(char, VIR_UUID_STRING_BUFLEN); - goto cleanup; =20 if (esxVI_QueryVirtualDiskUuid(priv->primary, datastorePath, priv->primary->datacenter->_ref= erence, diff --git a/src/libxl/libxl_capabilities.c b/src/libxl/libxl_capabilities.c index 622cba1bfc..2f3ed5bc83 100644 --- a/src/libxl/libxl_capabilities.c +++ b/src/libxl/libxl_capabilities.c @@ -284,7 +284,6 @@ libxlCapsInitNuma(libxl_ctx *ctx, virCapsPtr caps) =20 if (nr_cpus_node[node] =3D=3D 1) { cpus[node] =3D g_new0(virCapsHostNUMACellCPU, 1); - goto cleanup; } else { if (VIR_REALLOC_N(cpus[node], nr_cpus_node[node]) < 0) goto cleanup; @@ -323,7 +322,6 @@ libxlCapsInitNuma(libxl_ctx *ctx, virCapsPtr caps) size_t j; =20 siblings =3D g_new0(virCapsHostNUMACellSiblingInfo, nr_sibling= s); - goto cleanup; =20 for (j =3D 0; j < nr_siblings; j++) { siblings[j].node =3D j; diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c index 446449fb33..e28c649688 100644 --- a/src/libxl/libxl_driver.c +++ b/src/libxl/libxl_driver.c @@ -2762,7 +2762,6 @@ libxlConnectDomainXMLToNative(virConnectPtr conn, con= st char * nativeFormat, } =20 ret =3D g_new0(char, len); - goto cleanup; =20 if (virConfWriteMem(ret, &len, conf) < 0) { VIR_FREE(ret); diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index 1aa8b497dd..7a54fcb221 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -1280,7 +1280,6 @@ qemuDomainAttachNetDevice(virQEMUDriverPtr driver, tapfd =3D g_new0(int, tapfdSize); memset(tapfd, -1, sizeof(*tapfd) * tapfdSize); vhostfd =3D g_new0(int, vhostfdSize); - goto cleanup; memset(vhostfd, -1, sizeof(*vhostfd) * vhostfdSize); if (qemuInterfaceEthernetConnect(vm->def, driver, net, tapfd, tapfdSize) < 0) diff --git a/src/storage/storage_backend_iscsi_direct.c b/src/storage/stora= ge_backend_iscsi_direct.c index 66ceb48e6a..12b075db0b 100644 --- a/src/storage/storage_backend_iscsi_direct.c +++ b/src/storage/storage_backend_iscsi_direct.c @@ -626,7 +626,6 @@ virStorageBackendISCSIDirectVolWipeZero(virStorageVolDe= fPtr vol, if (virISCSIDirectGetVolumeCapacity(iscsi, lun, &block_size, &nb_block= )) return ret; data =3D g_new0(unsigned char, block_size * BLOCK_PER_PACKET); - return ret; =20 while (lba < nb_block) { const uint64_t to_write =3D MIN(nb_block - lba + 1, BLOCK_PER_PACK= ET); diff --git a/tools/virt-login-shell-helper.c b/tools/virt-login-shell-helpe= r.c index 0e7987bf82..0522896eee 100644 --- a/tools/virt-login-shell-helper.c +++ b/tools/virt-login-shell-helper.c @@ -100,7 +100,6 @@ static int virLoginShellGetShellArgv(virConfPtr conf, =20 if (rv =3D=3D 0) { *shargv =3D g_new0(char *, 2); - return -1; (*shargv)[0] =3D g_strdup("/bin/sh"); *shargvlen =3D 1; } else { --=20 2.26.2