From nobody Sat Apr 20 13:56:26 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) client-ip=207.211.31.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 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=1600099912; cv=none; d=zohomail.com; s=zohoarc; b=WyUl7cOLfgOAQ5l2YoK+Kez1XhUYWjNaMVzPnRNAzlWwbWuSJel9JOiEnmv4zAkUmlFrzsJSKw6LplvLBKIyBiD//08ZvbHAn4ZjfKKUOr5E0RC0Q8G5fGKSQMU1jMMgvczqK9JPindykSFifod2Z7YI8+8RvjkI+iD4v1dGtJ0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1600099912; 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=xoB3itdkH2zfoMcfHaGDtZab4majjnKRSb6pIx7pEV8=; b=GvF9iYfbWIjNdMnL6fLqdzr4PUPfDPVqbGiHwluLC4AH72VDx2IouXk5m4OZFdzp35cGlai//GBVYRiKR/HZ2KSJzvRB2ii4Aj9AvQSFJjPsO+A5zyVv89HVpbyGYa0DaJfp6WhQ48rxGhc081Or6u2chl8YhgV9OAg2m3rATgE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 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-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by mx.zohomail.com with SMTPS id 1600099912097355.86090568794657; Mon, 14 Sep 2020 09:11:52 -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-141-dw1LIQEEMUuSHE655Aa04w-1; Mon, 14 Sep 2020 12:11:48 -0400 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 46477884DD5; Mon, 14 Sep 2020 16:11:42 +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 038227EEC9; Mon, 14 Sep 2020 16:11:42 +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 80B0A8C7C9; Mon, 14 Sep 2020 16:11:41 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 08EG8Op4003672 for ; Mon, 14 Sep 2020 12:08:24 -0400 Received: by smtp.corp.redhat.com (Postfix) id E72127512A; Mon, 14 Sep 2020 16:08:24 +0000 (UTC) Received: from hjs.redhat.com (unknown [10.43.2.12]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6F21175139 for ; Mon, 14 Sep 2020 16:08:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1600099911; 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=xoB3itdkH2zfoMcfHaGDtZab4majjnKRSb6pIx7pEV8=; b=XQffYRG+/ILIwB7oNPjdzFFrn5tIf6COddtdhbZ//IJfURQfoWG2xdNPzy9SLbQ1mGMDFH zWvtX1RHBW2FScXuEc/EaRAROaMDqOiMCQCpEv9bUHQWUAyI2c4B7cmwRKvfSEIPjV6qlL l6EO0Fh7mg4lGVOxz4zfmCVYSWa8Kck= X-MC-Unique: dw1LIQEEMUuSHE655Aa04w-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH 1/3] virsh-completer: use g_clear_pointer in virshCommaStringListComplete Date: Mon, 14 Sep 2020 18:08:16 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 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.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0.002 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Signed-off-by: J=C3=A1n Tomko Reviewed-by: Michal Privoznik --- tools/virsh-completer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/virsh-completer.c b/tools/virsh-completer.c index 1d9d212f8a..bb6550ee63 100644 --- a/tools/virsh-completer.c +++ b/tools/virsh-completer.c @@ -105,7 +105,7 @@ virshCommaStringListComplete(const char *input, if ((comma =3D strrchr(inputCopy, ','))) *comma =3D '\0'; else - VIR_FREE(inputCopy); + g_clear_pointer(&inputCopy, g_free); } =20 if (inputCopy && !(inputList =3D virStringSplit(inputCopy, ",", 0))) --=20 2.26.2 From nobody Sat Apr 20 13:56:26 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) client-ip=207.211.31.81; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 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=1600099946; cv=none; d=zohomail.com; s=zohoarc; b=eUyJP+ltG0f0qSO5qWiakaAxPFU0pdl5hkzShnjwFXy4auycO4b5KT8MsZfNJtlThTRa/qzepVXuIUhLxQUDDuenKWBC0NpebiCLlGk3qKMmmIRRO/JvFQZwtoL4+MWbiA3vEhYgiqxuKtmQ9StPDb8CCkJSUjthUyVRGBO5M2s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1600099946; 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=ZRd0gLoxTw2XOIaR4zOFYsj/UjgWIWHQ4/++kuwfduY=; b=ZJi2OaL58Jxr4OdyztzIUsSkCBgEsPG2CMNR9JigHQxrFStKalRzrjLB76PNQAhMXQtqSFyy3dwcW5k35LXbvqekp+2KKg5QSFEFD4oYSNiOtwL6B9AMWt/MtH3B9ks2VlEAl0bsb9VLHM4XkYLtmYNJUMSugWXwg3DyHKviu8k= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 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-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 1600099946428921.5985733809388; Mon, 14 Sep 2020 09:12:26 -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-303-VKs7h5NnMiCVTmxhFdny-Q-1; Mon, 14 Sep 2020 12:12:22 -0400 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 9F8EA1091064; Mon, 14 Sep 2020 16:12:15 +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 7F2D67EEDA; Mon, 14 Sep 2020 16:12:15 +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 4B7BC1832FE6; Mon, 14 Sep 2020 16:12:15 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 08EG8PfX003680 for ; Mon, 14 Sep 2020 12:08:25 -0400 Received: by smtp.corp.redhat.com (Postfix) id B91507512A; Mon, 14 Sep 2020 16:08:25 +0000 (UTC) Received: from hjs.redhat.com (unknown [10.43.2.12]) by smtp.corp.redhat.com (Postfix) with ESMTP id 40BE375139 for ; Mon, 14 Sep 2020 16:08:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1600099945; 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=ZRd0gLoxTw2XOIaR4zOFYsj/UjgWIWHQ4/++kuwfduY=; b=eWNCmtwTBweKSHVZX8K51ULNq8p6ySxRQ68q2HoYdHJQyGr4bxl8cn2LolMoM6K8F8LwDK Mz9SKDiwseOeXz2SAr3sYLOANJHHwAZEYjP7IO72pZpMF2f0cr3t+OxFpRY2KWVVgwnBsm TtjAZ6BYtCVQeys1VK11uRd5w96+958= X-MC-Unique: VKs7h5NnMiCVTmxhFdny-Q-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH 2/3] virsh-completer: use g_free instead of VIR_FREE Date: Mon, 14 Sep 2020 18:08:17 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 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.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0.002 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) All of them are in the cleanup section right before the variables they free go out of scope. Signed-off-by: J=C3=A1n Tomko Reviewed-by: Michal Privoznik --- tools/virsh-completer-checkpoint.c | 8 ++++---- tools/virsh-completer-domain.c | 4 ++-- tools/virsh-completer-interface.c | 2 +- tools/virsh-completer-network.c | 12 ++++++------ tools/virsh-completer-nodedev.c | 2 +- tools/virsh-completer-nwfilter.c | 4 ++-- tools/virsh-completer-pool.c | 2 +- tools/virsh-completer-secret.c | 2 +- tools/virsh-completer-snapshot.c | 2 +- tools/virsh-completer-volume.c | 2 +- 10 files changed, 20 insertions(+), 20 deletions(-) diff --git a/tools/virsh-completer-checkpoint.c b/tools/virsh-completer-che= ckpoint.c index 21e8bb5d3b..0b5af2fa6b 100644 --- a/tools/virsh-completer-checkpoint.c +++ b/tools/virsh-completer-checkpoint.c @@ -60,7 +60,7 @@ virshCheckpointNameCompleter(vshControl *ctl, =20 virshDomainCheckpointFree(checkpoints[i]); } - VIR_FREE(checkpoints); + g_free(checkpoints); virshDomainFree(dom); =20 return ret; @@ -68,10 +68,10 @@ virshCheckpointNameCompleter(vshControl *ctl, error: for (; i < ncheckpoints; i++) virshDomainCheckpointFree(checkpoints[i]); - VIR_FREE(checkpoints); + g_free(checkpoints); for (i =3D 0; i < ncheckpoints; i++) - VIR_FREE(ret[i]); - VIR_FREE(ret); + g_free(ret[i]); + g_free(ret); virshDomainFree(dom); return NULL; } diff --git a/tools/virsh-completer-domain.c b/tools/virsh-completer-domain.c index 6bd09dcb0f..8159a0a58d 100644 --- a/tools/virsh-completer-domain.c +++ b/tools/virsh-completer-domain.c @@ -75,7 +75,7 @@ virshDomainNameCompleter(vshControl *ctl, cleanup: for (i =3D 0; i < ndomains; i++) virshDomainFree(domains[i]); - VIR_FREE(domains); + g_free(domains); return ret; } =20 @@ -127,7 +127,7 @@ virshDomainUUIDCompleter(vshControl *ctl, cleanup: for (i =3D 0; i < ndomains; i++) virshDomainFree(domains[i]); - VIR_FREE(domains); + g_free(domains); return ret; } =20 diff --git a/tools/virsh-completer-interface.c b/tools/virsh-completer-inte= rface.c index 417374322a..6ac11a402f 100644 --- a/tools/virsh-completer-interface.c +++ b/tools/virsh-completer-interface.c @@ -61,6 +61,6 @@ virshInterfaceNameCompleter(vshControl *ctl, cleanup: for (i =3D 0; i < nifaces; i++) virInterfaceFree(ifaces[i]); - VIR_FREE(ifaces); + g_free(ifaces); return ret; } diff --git a/tools/virsh-completer-network.c b/tools/virsh-completer-networ= k.c index c215e27720..c29d367c76 100644 --- a/tools/virsh-completer-network.c +++ b/tools/virsh-completer-network.c @@ -63,7 +63,7 @@ virshNetworkNameCompleter(vshControl *ctl, cleanup: for (i =3D 0; i < nnets; i++) virNetworkFree(nets[i]); - VIR_FREE(nets); + g_free(nets); return ret; } =20 @@ -124,17 +124,17 @@ virshNetworkPortUUIDCompleter(vshControl *ctl, =20 virNetworkPortFree(ports[i]); } - VIR_FREE(ports); + g_free(ports); =20 return ret; =20 error: for (; i < nports; i++) virNetworkPortFree(ports[i]); - VIR_FREE(ports); + g_free(ports); for (i =3D 0; i < nports; i++) - VIR_FREE(ret[i]); - VIR_FREE(ret); + g_free(ret[i]); + g_free(ret); return NULL; } =20 @@ -176,6 +176,6 @@ virshNetworkUUIDCompleter(vshControl *ctl, cleanup: for (i =3D 0; i < nnets; i++) virNetworkFree(nets[i]); - VIR_FREE(nets); + g_free(nets); return ret; } diff --git a/tools/virsh-completer-nodedev.c b/tools/virsh-completer-nodede= v.c index 5425f11262..94da5965f2 100644 --- a/tools/virsh-completer-nodedev.c +++ b/tools/virsh-completer-nodedev.c @@ -61,7 +61,7 @@ virshNodeDeviceNameCompleter(vshControl *ctl, cleanup: for (i =3D 0; i < ndevs; i++) virNodeDeviceFree(devs[i]); - VIR_FREE(devs); + g_free(devs); return ret; } =20 diff --git a/tools/virsh-completer-nwfilter.c b/tools/virsh-completer-nwfil= ter.c index 989a363847..a3fbeded29 100644 --- a/tools/virsh-completer-nwfilter.c +++ b/tools/virsh-completer-nwfilter.c @@ -59,7 +59,7 @@ virshNWFilterNameCompleter(vshControl *ctl, cleanup: for (i =3D 0; i < nnwfilters; i++) virNWFilterFree(nwfilters[i]); - VIR_FREE(nwfilters); + g_free(nwfilters); return ret; } =20 @@ -98,6 +98,6 @@ virshNWFilterBindingNameCompleter(vshControl *ctl, cleanup: for (i =3D 0; i < nbindings; i++) virNWFilterBindingFree(bindings[i]); - VIR_FREE(bindings); + g_free(bindings); return ret; } diff --git a/tools/virsh-completer-pool.c b/tools/virsh-completer-pool.c index ed3b1e35ff..35eeed6043 100644 --- a/tools/virsh-completer-pool.c +++ b/tools/virsh-completer-pool.c @@ -64,7 +64,7 @@ virshStoragePoolNameCompleter(vshControl *ctl, cleanup: for (i =3D 0; i < npools; i++) virStoragePoolFree(pools[i]); - VIR_FREE(pools); + g_free(pools); return ret; } =20 diff --git a/tools/virsh-completer-secret.c b/tools/virsh-completer-secret.c index 505b19db84..568599c6e4 100644 --- a/tools/virsh-completer-secret.c +++ b/tools/virsh-completer-secret.c @@ -63,7 +63,7 @@ virshSecretUUIDCompleter(vshControl *ctl, cleanup: for (i =3D 0; i < nsecrets; i++) virshSecretFree(secrets[i]); - VIR_FREE(secrets); + g_free(secrets); return ret; } =20 diff --git a/tools/virsh-completer-snapshot.c b/tools/virsh-completer-snaps= hot.c index aa1135d132..9ab74bb471 100644 --- a/tools/virsh-completer-snapshot.c +++ b/tools/virsh-completer-snapshot.c @@ -67,6 +67,6 @@ virshSnapshotNameCompleter(vshControl *ctl, virshDomainFree(dom); for (i =3D 0; i < nsnapshots; i++) virshDomainSnapshotFree(snapshots[i]); - VIR_FREE(snapshots); + g_free(snapshots); return ret; } diff --git a/tools/virsh-completer-volume.c b/tools/virsh-completer-volume.c index ad54261534..296e67dd71 100644 --- a/tools/virsh-completer-volume.c +++ b/tools/virsh-completer-volume.c @@ -67,6 +67,6 @@ virshStorageVolNameCompleter(vshControl *ctl, virStoragePoolFree(pool); for (i =3D 0; i < nvols; i++) virStorageVolFree(vols[i]); - VIR_FREE(vols); + g_free(vols); return ret; } --=20 2.26.2 From nobody Sat Apr 20 13:56:26 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) client-ip=205.139.110.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 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=1600099999; cv=none; d=zohomail.com; s=zohoarc; b=D19ki59YF6t8igjuYpZf3qnJ3O6HMg6BJuGCGsF56OZrcLFnt5ygIueCacFDeS7siMx672G7pRPHrl+Pfpi5NE20gomV2Aq7oiF5fSHWxia3tVxEY6CzTj7QnDWh3XNMZFyWG0xNczqETj+4kGHPNwi4sXtcj30xdYUWIXtmqAQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1600099999; 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=0xtRbmMyFkNYFGpffBXujIF1B9hhHPO9eQa1c2j3Htw=; b=PUygL7to5TVSJ5BHmSwlNfaRxzyKJc57AxIe8AyOW7XLrXVO+r5WUew3ASfR9dG0GCsRhqotFqBxuhCUYo5gccOAjic14RyTbdaw/KhvtEkgGWz6j/niDAxwn5DMdlv44FPuNLqG7H+YdtA7YtduKM78TBvaY/dLuIF5GBd3P2A= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 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-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by mx.zohomail.com with SMTPS id 1600099999218548.0833272254839; Mon, 14 Sep 2020 09:13:19 -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-530-1IO1kwb5Mlu6PbEOhqbknw-1; Mon, 14 Sep 2020 12:13:15 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id A11E2425DA; Mon, 14 Sep 2020 16:13:10 +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 2F5A260C87; Mon, 14 Sep 2020 16:13: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 EF4621832FF5; Mon, 14 Sep 2020 16:13:09 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 08EG8QrK003687 for ; Mon, 14 Sep 2020 12:08:26 -0400 Received: by smtp.corp.redhat.com (Postfix) id B05927512C; Mon, 14 Sep 2020 16:08:26 +0000 (UTC) Received: from hjs.redhat.com (unknown [10.43.2.12]) by smtp.corp.redhat.com (Postfix) with ESMTP id 122AF7512A for ; Mon, 14 Sep 2020 16:08:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1600099998; 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=0xtRbmMyFkNYFGpffBXujIF1B9hhHPO9eQa1c2j3Htw=; b=NgL86TckQj8R41RkkaKOajJIJOjpxQWES0huj6HFnpe/T6u3e2W++5dd+NuyCfqBKfHqjh kT6ePqbOXjQ1TqBeLGyRWYEr1sbniI0cQ3z+kx/uss6Dowlm1EpqWhqlZLsuhgOwSVW1VC sM4CSHPZDsVlYm3l6dKQue9IWGV2A+4= X-MC-Unique: 1IO1kwb5Mlu6PbEOhqbknw-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH 3/3] virsh-completer: use g_new0 instead of VIR_ALLOC_N Date: Mon, 14 Sep 2020 18:08:18 +0200 Message-Id: <164a3c0702f7e7a12886a373595abaedcc2a4cb6.1600099538.git.jtomko@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 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.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0.003 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Signed-off-by: J=C3=A1n Tomko Reviewed-by: Michal Privoznik --- tools/virsh-completer-checkpoint.c | 3 +-- tools/virsh-completer-domain.c | 40 ++++++++++-------------------- tools/virsh-completer-host.c | 6 ++--- tools/virsh-completer-interface.c | 4 +-- tools/virsh-completer-network.c | 13 +++------- tools/virsh-completer-nodedev.c | 10 +++----- tools/virsh-completer-nwfilter.c | 8 ++---- tools/virsh-completer-pool.c | 10 +++----- tools/virsh-completer-secret.c | 6 ++--- tools/virsh-completer-snapshot.c | 3 +-- tools/virsh-completer-volume.c | 3 +-- tools/virsh-completer.c | 3 +-- 12 files changed, 34 insertions(+), 75 deletions(-) diff --git a/tools/virsh-completer-checkpoint.c b/tools/virsh-completer-che= ckpoint.c index 0b5af2fa6b..29d644dad0 100644 --- a/tools/virsh-completer-checkpoint.c +++ b/tools/virsh-completer-checkpoint.c @@ -50,8 +50,7 @@ virshCheckpointNameCompleter(vshControl *ctl, flags)) < 0) goto error; =20 - if (VIR_ALLOC_N(ret, ncheckpoints + 1) < 0) - goto error; + ret =3D g_new0(char *, ncheckpoints + 1); =20 for (i =3D 0; i < ncheckpoints; i++) { const char *name =3D virDomainCheckpointGetName(checkpoints[i]); diff --git a/tools/virsh-completer-domain.c b/tools/virsh-completer-domain.c index 8159a0a58d..50a8a31fcd 100644 --- a/tools/virsh-completer-domain.c +++ b/tools/virsh-completer-domain.c @@ -61,8 +61,7 @@ virshDomainNameCompleter(vshControl *ctl, if ((ndomains =3D virConnectListAllDomains(priv->conn, &domains, flags= )) < 0) return NULL; =20 - if (VIR_ALLOC_N(tmp, ndomains + 1) < 0) - goto cleanup; + tmp =3D g_new0(char *, ndomains + 1); =20 for (i =3D 0; i < ndomains; i++) { const char *name =3D virDomainGetName(domains[i]); @@ -72,7 +71,6 @@ virshDomainNameCompleter(vshControl *ctl, =20 ret =3D g_steal_pointer(&tmp); =20 - cleanup: for (i =3D 0; i < ndomains; i++) virshDomainFree(domains[i]); g_free(domains); @@ -110,8 +108,7 @@ virshDomainUUIDCompleter(vshControl *ctl, if ((ndomains =3D virConnectListAllDomains(priv->conn, &domains, flags= )) < 0) return NULL; =20 - if (VIR_ALLOC_N(tmp, ndomains + 1) < 0) - goto cleanup; + tmp =3D g_new0(char *, ndomains + 1); =20 for (i =3D 0; i < ndomains; i++) { char uuid[VIR_UUID_STRING_BUFLEN]; @@ -161,8 +158,7 @@ virshDomainInterfaceCompleter(vshControl *ctl, if (ninterfaces < 0) return NULL; =20 - if (VIR_ALLOC_N(tmp, ninterfaces + 1) < 0) - return NULL; + tmp =3D g_new0(char *, ninterfaces + 1); =20 for (i =3D 0; i < ninterfaces; i++) { ctxt->node =3D interfaces[i]; @@ -206,8 +202,7 @@ virshDomainDiskTargetCompleter(vshControl *ctl, if (ndisks < 0) return NULL; =20 - if (VIR_ALLOC_N(tmp, ndisks + 1) < 0) - return NULL; + tmp =3D g_new0(char *, ndisks + 1); =20 for (i =3D 0; i < ndisks; i++) { ctxt->node =3D disks[i]; @@ -229,8 +224,7 @@ virshDomainEventNameCompleter(vshControl *ctl G_GNUC_UN= USED, =20 virCheckFlags(0, NULL); =20 - if (VIR_ALLOC_N(tmp, VIR_DOMAIN_EVENT_ID_LAST + 1) < 0) - return NULL; + tmp =3D g_new0(char *, VIR_DOMAIN_EVENT_ID_LAST + 1); =20 for (i =3D 0; i < VIR_DOMAIN_EVENT_ID_LAST; i++) tmp[i] =3D g_strdup(virshDomainEventCallbacks[i].name); @@ -283,8 +277,7 @@ virshDomainInterfaceStateCompleter(vshControl *ctl, =20 ctxt->node =3D interfaces[0]; =20 - if (VIR_ALLOC_N(tmp, 2) < 0) - return NULL; + tmp =3D g_new0(char *, 2); =20 if ((state =3D virXPathString("string(./link/@state)", ctxt)) && STREQ(state, "down")) { @@ -326,8 +319,7 @@ virshDomainDeviceAliasCompleter(vshControl *ctl, if (naliases < 0) return NULL; =20 - if (VIR_ALLOC_N(tmp, naliases + 1) < 0) - return NULL; + tmp =3D g_new0(char *, naliases + 1); =20 for (i =3D 0; i < naliases; i++) { if (!(tmp[i] =3D virXMLNodeContentString(aliases[i]))) @@ -404,8 +396,7 @@ virshDomainPerfEnableCompleter(vshControl *ctl, =20 virCheckFlags(0, NULL); =20 - if (VIR_ALLOC_N(events, VIR_PERF_EVENT_LAST + 1) < 0) - return NULL; + events =3D g_new0(char *, VIR_PERF_EVENT_LAST + 1); =20 for (i =3D 0; i < VIR_PERF_EVENT_LAST; i++) events[i] =3D g_strdup(virPerfEventTypeToString(i)); @@ -428,8 +419,7 @@ virshDomainPerfDisableCompleter(vshControl *ctl, =20 virCheckFlags(0, NULL); =20 - if (VIR_ALLOC_N(events, VIR_PERF_EVENT_LAST + 1) < 0) - return NULL; + events =3D g_new0(char *, VIR_PERF_EVENT_LAST + 1); =20 for (i =3D 0; i < VIR_PERF_EVENT_LAST; i++) events[i] =3D g_strdup(virPerfEventTypeToString(i)); @@ -464,8 +454,7 @@ virshDomainIOThreadIdCompleter(vshControl *ctl, =20 niothreads =3D rc; =20 - if (VIR_ALLOC_N(tmp, niothreads + 1) < 0) - goto cleanup; + tmp =3D g_new0(char *, niothreads + 1); =20 for (i =3D 0; i < niothreads; i++) tmp[i] =3D g_strdup_printf("%u", info[i]->iothread_id); @@ -504,8 +493,7 @@ virshDomainVcpuCompleter(vshControl *ctl, if (virXPathInt("string(/domain/vcpu)", ctxt, &nvcpus) < 0) goto cleanup; =20 - if (VIR_ALLOC_N(tmp, nvcpus + 1) < 0) - goto cleanup; + tmp =3D g_new0(char *, nvcpus + 1); =20 for (id =3D 0; id < nvcpus; id++) tmp[id] =3D g_strdup_printf("%u", id); @@ -550,8 +538,7 @@ virshDomainVcpulistCompleter(vshControl *ctl, if (virXPathInt("string(/domain/vcpu)", ctxt, &nvcpus) < 0) goto cleanup; =20 - if (VIR_ALLOC_N(vcpulist, nvcpus + 1) < 0) - goto cleanup; + vcpulist =3D g_new0(char *, nvcpus + 1); =20 for (id =3D 0; id < nvcpus; id++) vcpulist[id] =3D g_strdup_printf("%u", id); @@ -587,8 +574,7 @@ virshDomainCpulistCompleter(vshControl *ctl, if ((cpunum =3D virNodeGetCPUMap(priv->conn, &cpumap, &online, 0)) < 0) return NULL; =20 - if (VIR_ALLOC_N(cpulist, cpunum + 1) < 0) - return NULL; + cpulist =3D g_new0(char *, cpunum + 1); =20 for (i =3D 0; i < cpunum; i++) cpulist[i] =3D g_strdup_printf("%zu", i); diff --git a/tools/virsh-completer-host.c b/tools/virsh-completer-host.c index 8893888ec2..339390aa00 100644 --- a/tools/virsh-completer-host.c +++ b/tools/virsh-completer-host.c @@ -87,8 +87,7 @@ virshAllocpagesPagesizeCompleter(vshControl *ctl, if (npages <=3D 0) return NULL; =20 - if (VIR_ALLOC_N(tmp, npages + 1) < 0) - return NULL; + tmp =3D g_new0(char *, npages + 1); =20 for (i =3D 0; i < npages; i++) { if (!(tmp[i] =3D virshPagesizeNodeToString(pages[i]))) @@ -128,8 +127,7 @@ virshCellnoCompleter(vshControl *ctl, if (ncells <=3D 0) return NULL; =20 - if (VIR_ALLOC_N(tmp, ncells + 1)) - return NULL; + tmp =3D g_new0(char *, ncells + 1); =20 for (i =3D 0; i < ncells; i++) { if (!(tmp[i] =3D virXMLPropString(cells[i], "id"))) diff --git a/tools/virsh-completer-interface.c b/tools/virsh-completer-inte= rface.c index 6ac11a402f..8028db8746 100644 --- a/tools/virsh-completer-interface.c +++ b/tools/virsh-completer-interface.c @@ -47,8 +47,7 @@ virshInterfaceNameCompleter(vshControl *ctl, if ((nifaces =3D virConnectListAllInterfaces(priv->conn, &ifaces, flag= s)) < 0) return NULL; =20 - if (VIR_ALLOC_N(tmp, nifaces + 1) < 0) - goto cleanup; + tmp =3D g_new0(char *, nifaces + 1); =20 for (i =3D 0; i < nifaces; i++) { const char *name =3D virInterfaceGetName(ifaces[i]); @@ -58,7 +57,6 @@ virshInterfaceNameCompleter(vshControl *ctl, =20 ret =3D g_steal_pointer(&tmp); =20 - cleanup: for (i =3D 0; i < nifaces; i++) virInterfaceFree(ifaces[i]); g_free(ifaces); diff --git a/tools/virsh-completer-network.c b/tools/virsh-completer-networ= k.c index c29d367c76..a63d657477 100644 --- a/tools/virsh-completer-network.c +++ b/tools/virsh-completer-network.c @@ -49,8 +49,7 @@ virshNetworkNameCompleter(vshControl *ctl, if ((nnets =3D virConnectListAllNetworks(priv->conn, &nets, flags)) < = 0) return NULL; =20 - if (VIR_ALLOC_N(tmp, nnets + 1) < 0) - goto cleanup; + tmp =3D g_new0(char *, nnets + 1); =20 for (i =3D 0; i < nnets; i++) { const char *name =3D virNetworkGetName(nets[i]); @@ -60,7 +59,6 @@ virshNetworkNameCompleter(vshControl *ctl, =20 ret =3D g_steal_pointer(&tmp); =20 - cleanup: for (i =3D 0; i < nnets; i++) virNetworkFree(nets[i]); g_free(nets); @@ -78,8 +76,7 @@ virshNetworkEventNameCompleter(vshControl *ctl G_GNUC_UNU= SED, =20 virCheckFlags(0, NULL); =20 - if (VIR_ALLOC_N(tmp, VIR_NETWORK_EVENT_ID_LAST + 1) < 0) - return NULL; + tmp =3D g_new0(char *, VIR_NETWORK_EVENT_ID_LAST + 1); =20 for (i =3D 0; i < VIR_NETWORK_EVENT_ID_LAST; i++) tmp[i] =3D g_strdup(virshNetworkEventCallbacks[i].name); @@ -111,8 +108,7 @@ virshNetworkPortUUIDCompleter(vshControl *ctl, if ((nports =3D virNetworkListAllPorts(net, &ports, flags)) < 0) return NULL; =20 - if (VIR_ALLOC_N(ret, nports + 1) < 0) - goto error; + ret =3D g_new0(char *, nports + 1); =20 for (i =3D 0; i < nports; i++) { char uuid[VIR_UUID_STRING_BUFLEN]; @@ -159,8 +155,7 @@ virshNetworkUUIDCompleter(vshControl *ctl, if ((nnets =3D virConnectListAllNetworks(priv->conn, &nets, flags)) < = 0) return NULL; =20 - if (VIR_ALLOC_N(tmp, nnets + 1) < 0) - goto cleanup; + tmp =3D g_new0(char *, nnets + 1); =20 for (i =3D 0; i < nnets; i++) { char uuid[VIR_UUID_STRING_BUFLEN]; diff --git a/tools/virsh-completer-nodedev.c b/tools/virsh-completer-nodede= v.c index 94da5965f2..a9fc37733c 100644 --- a/tools/virsh-completer-nodedev.c +++ b/tools/virsh-completer-nodedev.c @@ -47,8 +47,7 @@ virshNodeDeviceNameCompleter(vshControl *ctl, if ((ndevs =3D virConnectListAllNodeDevices(priv->conn, &devs, flags))= < 0) return NULL; =20 - if (VIR_ALLOC_N(tmp, ndevs + 1) < 0) - goto cleanup; + tmp =3D g_new0(char *, ndevs + 1); =20 for (i =3D 0; i < ndevs; i++) { const char *name =3D virNodeDeviceGetName(devs[i]); @@ -58,7 +57,6 @@ virshNodeDeviceNameCompleter(vshControl *ctl, =20 ret =3D g_steal_pointer(&tmp); =20 - cleanup: for (i =3D 0; i < ndevs; i++) virNodeDeviceFree(devs[i]); g_free(devs); @@ -76,8 +74,7 @@ virshNodeDeviceEventNameCompleter(vshControl *ctl G_GNUC_= UNUSED, =20 virCheckFlags(0, NULL); =20 - if (VIR_ALLOC_N(tmp, VIR_NODE_DEVICE_EVENT_ID_LAST + 1) < 0) - return NULL; + tmp =3D g_new0(char *, VIR_NODE_DEVICE_EVENT_ID_LAST + 1); =20 for (i =3D 0; i < VIR_NODE_DEVICE_EVENT_ID_LAST; i++) tmp[i] =3D g_strdup(virshNodeDeviceEventCallbacks[i].name); @@ -100,8 +97,7 @@ virshNodeDeviceCapabilityNameCompleter(vshControl *ctl, if (vshCommandOptStringQuiet(ctl, cmd, "cap", &cap_str) < 0) return NULL; =20 - if (VIR_ALLOC_N(tmp, VIR_NODE_DEV_CAP_LAST + 1) < 0) - return NULL; + tmp =3D g_new0(char *, VIR_NODE_DEV_CAP_LAST + 1); =20 for (i =3D 0; i < VIR_NODE_DEV_CAP_LAST; i++) tmp[i] =3D g_strdup(virNodeDevCapTypeToString(i)); diff --git a/tools/virsh-completer-nwfilter.c b/tools/virsh-completer-nwfil= ter.c index a3fbeded29..b1aa084b49 100644 --- a/tools/virsh-completer-nwfilter.c +++ b/tools/virsh-completer-nwfilter.c @@ -45,8 +45,7 @@ virshNWFilterNameCompleter(vshControl *ctl, if ((nnwfilters =3D virConnectListAllNWFilters(priv->conn, &nwfilters,= flags)) < 0) return NULL; =20 - if (VIR_ALLOC_N(tmp, nnwfilters + 1) < 0) - goto cleanup; + tmp =3D g_new0(char *, nnwfilters + 1); =20 for (i =3D 0; i < nnwfilters; i++) { const char *name =3D virNWFilterGetName(nwfilters[i]); @@ -56,7 +55,6 @@ virshNWFilterNameCompleter(vshControl *ctl, =20 ret =3D g_steal_pointer(&tmp); =20 - cleanup: for (i =3D 0; i < nnwfilters; i++) virNWFilterFree(nwfilters[i]); g_free(nwfilters); @@ -84,8 +82,7 @@ virshNWFilterBindingNameCompleter(vshControl *ctl, if ((nbindings =3D virConnectListAllNWFilterBindings(priv->conn, &bind= ings, flags)) < 0) return NULL; =20 - if (VIR_ALLOC_N(tmp, nbindings + 1) < 0) - goto cleanup; + tmp =3D g_new0(char *, nbindings + 1); =20 for (i =3D 0; i < nbindings; i++) { const char *name =3D virNWFilterBindingGetPortDev(bindings[i]); @@ -95,7 +92,6 @@ virshNWFilterBindingNameCompleter(vshControl *ctl, =20 ret =3D g_steal_pointer(&tmp); =20 - cleanup: for (i =3D 0; i < nbindings; i++) virNWFilterBindingFree(bindings[i]); g_free(bindings); diff --git a/tools/virsh-completer-pool.c b/tools/virsh-completer-pool.c index 35eeed6043..ecf2514a59 100644 --- a/tools/virsh-completer-pool.c +++ b/tools/virsh-completer-pool.c @@ -50,8 +50,7 @@ virshStoragePoolNameCompleter(vshControl *ctl, if ((npools =3D virConnectListAllStoragePools(priv->conn, &pools, flag= s)) < 0) return NULL; =20 - if (VIR_ALLOC_N(tmp, npools + 1) < 0) - goto cleanup; + tmp =3D g_new0(char *, npools + 1); =20 for (i =3D 0; i < npools; i++) { const char *name =3D virStoragePoolGetName(pools[i]); @@ -61,7 +60,6 @@ virshStoragePoolNameCompleter(vshControl *ctl, =20 ret =3D g_steal_pointer(&tmp); =20 - cleanup: for (i =3D 0; i < npools; i++) virStoragePoolFree(pools[i]); g_free(pools); @@ -79,8 +77,7 @@ virshPoolEventNameCompleter(vshControl *ctl G_GNUC_UNUSED, =20 virCheckFlags(0, NULL); =20 - if (VIR_ALLOC_N(tmp, VIR_STORAGE_POOL_EVENT_ID_LAST + 1) < 0) - return NULL; + tmp =3D g_new0(char *, VIR_STORAGE_POOL_EVENT_ID_LAST + 1); =20 for (i =3D 0; i < VIR_STORAGE_POOL_EVENT_ID_LAST; i++) tmp[i] =3D g_strdup(virshPoolEventCallbacks[i].name); @@ -103,8 +100,7 @@ virshPoolTypeCompleter(vshControl *ctl, if (vshCommandOptStringQuiet(ctl, cmd, "type", &type_str) < 0) return NULL; =20 - if (VIR_ALLOC_N(tmp, VIR_STORAGE_POOL_LAST + 1) < 0) - return NULL; + tmp =3D g_new0(char *, VIR_STORAGE_POOL_LAST + 1); =20 for (i =3D 0; i < VIR_STORAGE_POOL_LAST; i++) tmp[i] =3D g_strdup(virStoragePoolTypeToString(i)); diff --git a/tools/virsh-completer-secret.c b/tools/virsh-completer-secret.c index 568599c6e4..940d65a322 100644 --- a/tools/virsh-completer-secret.c +++ b/tools/virsh-completer-secret.c @@ -47,8 +47,7 @@ virshSecretUUIDCompleter(vshControl *ctl, if ((nsecrets =3D virConnectListAllSecrets(priv->conn, &secrets, flags= )) < 0) return NULL; =20 - if (VIR_ALLOC_N(tmp, nsecrets + 1) < 0) - goto cleanup; + tmp =3D g_new0(char *, nsecrets + 1); =20 for (i =3D 0; i < nsecrets; i++) { char uuid[VIR_UUID_STRING_BUFLEN]; @@ -78,8 +77,7 @@ virshSecretEventNameCompleter(vshControl *ctl G_GNUC_UNUS= ED, =20 virCheckFlags(0, NULL); =20 - if (VIR_ALLOC_N(tmp, VIR_SECRET_EVENT_ID_LAST + 1) < 0) - return NULL; + tmp =3D g_new0(char *, VIR_SECRET_EVENT_ID_LAST + 1); =20 for (i =3D 0; i < VIR_SECRET_EVENT_ID_LAST; i++) tmp[i] =3D g_strdup(virshSecretEventCallbacks[i].name); diff --git a/tools/virsh-completer-snapshot.c b/tools/virsh-completer-snaps= hot.c index 9ab74bb471..f6aa405ea3 100644 --- a/tools/virsh-completer-snapshot.c +++ b/tools/virsh-completer-snapshot.c @@ -52,8 +52,7 @@ virshSnapshotNameCompleter(vshControl *ctl, goto cleanup; nsnapshots =3D rc; =20 - if (VIR_ALLOC_N(tmp, nsnapshots + 1) < 0) - goto cleanup; + tmp =3D g_new0(char *, nsnapshots + 1); =20 for (i =3D 0; i < nsnapshots; i++) { const char *name =3D virDomainSnapshotGetName(snapshots[i]); diff --git a/tools/virsh-completer-volume.c b/tools/virsh-completer-volume.c index 296e67dd71..29330f5bd8 100644 --- a/tools/virsh-completer-volume.c +++ b/tools/virsh-completer-volume.c @@ -52,8 +52,7 @@ virshStorageVolNameCompleter(vshControl *ctl, goto cleanup; nvols =3D rc; =20 - if (VIR_ALLOC_N(tmp, nvols + 1) < 0) - goto cleanup; + tmp =3D g_new0(char *, nvols + 1); =20 for (i =3D 0; i < nvols; i++) { const char *name =3D virStorageVolGetName(vols[i]); diff --git a/tools/virsh-completer.c b/tools/virsh-completer.c index bb6550ee63..08f3825e89 100644 --- a/tools/virsh-completer.c +++ b/tools/virsh-completer.c @@ -111,8 +111,7 @@ virshCommaStringListComplete(const char *input, if (inputCopy && !(inputList =3D virStringSplit(inputCopy, ",", 0))) return NULL; =20 - if (VIR_ALLOC_N(ret, optionsLen + 1) < 0) - return NULL; + ret =3D g_new0(char *, optionsLen + 1); =20 for (i =3D 0; i < optionsLen; i++) { if (virStringListHasString((const char **)inputList, options[i])) --=20 2.26.2