From nobody Sun Feb 8 20:53:26 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 205.139.110.61 as permitted sender) client-ip=205.139.110.61; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 205.139.110.61 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=1571576224; cv=none; d=zoho.com; s=zohoarc; b=aYHjZmvOkeafICwNyZKuakZdfA4671oiN1WqE6PlEt0Yxa9Jo3qw9byV/o4YgesQ10mCLf/ZWnS+RIVXVc3ABW58z3fBoFsq+O7zvLQnwoWMuclkyUo1Q2H/lI/tt4YkRBXATK0WsXaSbz/CFUtzF9zXK4OSjmC3nAx1bghRSnQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571576224; 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=SVJqQgfStVP9spNqamGKmMExhOQpyV3uL69ZfZpfVAU=; b=UAOA4Qbquz8Dm4jDjH8tMffKnGJLioKQKpxPJAmFz3D+RFxgKIDo1S+JciITD3MP8XuECqulWz7e0IuUM6QqJ7pJLVCJC13K8C8DyyJiQKTzTY2YAdzkmn/g9MdIUTHZH1P67Flqf9im9DGHkIM18RIlAZLQ0mC6UEKsoPZ83Xg= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 205.139.110.61 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-1.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 1571576224115824.1920457138111; Sun, 20 Oct 2019 05:57:04 -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-254-SSq73I6mM4ePbB2eRmaDtg-1; Sun, 20 Oct 2019 08:56:55 -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 D742A107AFA9; Sun, 20 Oct 2019 12:56:50 +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 6BE215C241; Sun, 20 Oct 2019 12:56:50 +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 179C21804761; Sun, 20 Oct 2019 12:56:50 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x9KCuFGd023655 for ; Sun, 20 Oct 2019 08:56:15 -0400 Received: by smtp.corp.redhat.com (Postfix) id 0BB9D90B3; Sun, 20 Oct 2019 12:56:15 +0000 (UTC) Received: from lpt.redhat.com (ovpn-200-23.brq.redhat.com [10.40.200.23]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5E7103DA3 for ; Sun, 20 Oct 2019 12:56:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1571576222; 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=SVJqQgfStVP9spNqamGKmMExhOQpyV3uL69ZfZpfVAU=; b=N2S9pmEc38gC/a8Hv4SuyvjsgU3/jcjEs8nTVcptl4tdwSJER4zBDW16QtOgtak00E1G9W UQv6JGNxfHsXpczljvtytrCw+ilRRH/k1UVLurinZI9/B5o4/RsKx5tS3/7/A8brVS6FiR lP+uCw/IhvLc5+/Oej+J23Pv4fLYJhw= From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Date: Sun, 20 Oct 2019 14:55:51 +0200 Message-Id: <3fe20fdd710775d6aacfa2ca161574b6d16adcf1.1571575890.git.jtomko@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 33/34] tools: use g_strdup instead of VIR_STRDUP 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 X-MC-Unique: SSq73I6mM4ePbB2eRmaDtg-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Replace all occurrences of if (VIR_STRDUP(a, b) < 0) /* effectively dead code */ with: a =3D g_strdup(b); Signed-off-by: J=C3=A1n Tomko --- tools/virsh-completer-checkpoint.c | 3 +-- tools/virsh-completer-domain.c | 15 +++++---------- tools/virsh-completer-interface.c | 3 +-- tools/virsh-completer-network.c | 14 ++++++-------- tools/virsh-completer-nodedev.c | 15 +++++---------- tools/virsh-completer-nwfilter.c | 6 ++---- tools/virsh-completer-pool.c | 15 +++++---------- tools/virsh-completer-secret.c | 10 ++++------ tools/virsh-completer-snapshot.c | 3 +-- tools/virsh-completer-volume.c | 3 +-- tools/virsh-completer.c | 8 ++++---- tools/virt-admin-completer.c | 3 +-- tools/virt-login-shell-helper.c | 17 +++++------------ tools/vsh-table.c | 3 +-- tools/vsh.c | 11 ++++------- 15 files changed, 46 insertions(+), 83 deletions(-) diff --git a/tools/virsh-completer-checkpoint.c b/tools/virsh-completer-che= ckpoint.c index ce9d32844d..21e8bb5d3b 100644 --- a/tools/virsh-completer-checkpoint.c +++ b/tools/virsh-completer-checkpoint.c @@ -56,8 +56,7 @@ virshCheckpointNameCompleter(vshControl *ctl, for (i =3D 0; i < ncheckpoints; i++) { const char *name =3D virDomainCheckpointGetName(checkpoints[i]); =20 - if (VIR_STRDUP(ret[i], name) < 0) - goto error; + ret[i] =3D g_strdup(name); =20 virshDomainCheckpointFree(checkpoints[i]); } diff --git a/tools/virsh-completer-domain.c b/tools/virsh-completer-domain.c index bb06f468d7..6bfa3ab58c 100644 --- a/tools/virsh-completer-domain.c +++ b/tools/virsh-completer-domain.c @@ -62,8 +62,7 @@ virshDomainNameCompleter(vshControl *ctl, for (i =3D 0; i < ndomains; i++) { const char *name =3D virDomainGetName(domains[i]); =20 - if (VIR_STRDUP(tmp[i], name) < 0) - goto cleanup; + tmp[i] =3D g_strdup(name); } =20 ret =3D g_steal_pointer(&tmp); @@ -181,10 +180,8 @@ virshDomainEventNameCompleter(vshControl *ctl G_GNUC_U= NUSED, if (VIR_ALLOC_N(tmp, VIR_DOMAIN_EVENT_ID_LAST + 1) < 0) return NULL; =20 - for (i =3D 0; i < VIR_DOMAIN_EVENT_ID_LAST; i++) { - if (VIR_STRDUP(tmp[i], virshDomainEventCallbacks[i].name) < 0) - return NULL; - } + for (i =3D 0; i < VIR_DOMAIN_EVENT_ID_LAST; i++) + tmp[i] =3D g_strdup(virshDomainEventCallbacks[i].name); =20 ret =3D g_steal_pointer(&tmp); return ret; @@ -242,11 +239,9 @@ virshDomainInterfaceStateCompleter(vshControl *ctl, =20 if ((state =3D virXPathString("string(./link/@state)", ctxt)) && STREQ(state, "down")) { - if (VIR_STRDUP(tmp[0], "up") < 0) - return NULL; + tmp[0] =3D g_strdup("up"); } else { - if (VIR_STRDUP(tmp[0], "down") < 0) - return NULL; + tmp[0] =3D g_strdup("down"); } =20 ret =3D g_steal_pointer(&tmp); diff --git a/tools/virsh-completer-interface.c b/tools/virsh-completer-inte= rface.c index 6fae0f6584..417374322a 100644 --- a/tools/virsh-completer-interface.c +++ b/tools/virsh-completer-interface.c @@ -53,8 +53,7 @@ virshInterfaceNameCompleter(vshControl *ctl, for (i =3D 0; i < nifaces; i++) { const char *name =3D virInterfaceGetName(ifaces[i]); =20 - if (VIR_STRDUP(tmp[i], name) < 0) - goto cleanup; + tmp[i] =3D g_strdup(name); } =20 ret =3D g_steal_pointer(&tmp); diff --git a/tools/virsh-completer-network.c b/tools/virsh-completer-networ= k.c index a3d8b71d19..0097fca7cc 100644 --- a/tools/virsh-completer-network.c +++ b/tools/virsh-completer-network.c @@ -55,8 +55,7 @@ virshNetworkNameCompleter(vshControl *ctl, for (i =3D 0; i < nnets; i++) { const char *name =3D virNetworkGetName(nets[i]); =20 - if (VIR_STRDUP(tmp[i], name) < 0) - goto cleanup; + tmp[i] =3D g_strdup(name); } =20 ret =3D g_steal_pointer(&tmp); @@ -83,10 +82,8 @@ virshNetworkEventNameCompleter(vshControl *ctl G_GNUC_UN= USED, if (VIR_ALLOC_N(tmp, VIR_NETWORK_EVENT_ID_LAST + 1) < 0) goto cleanup; =20 - for (i =3D 0; i < VIR_NETWORK_EVENT_ID_LAST; i++) { - if (VIR_STRDUP(tmp[i], virshNetworkEventCallbacks[i].name) < 0) - goto cleanup; - } + for (i =3D 0; i < VIR_NETWORK_EVENT_ID_LAST; i++) + tmp[i] =3D g_strdup(virshNetworkEventCallbacks[i].name); =20 ret =3D g_steal_pointer(&tmp); =20 @@ -124,10 +121,11 @@ virshNetworkPortUUIDCompleter(vshControl *ctl, for (i =3D 0; i < nports; i++) { char uuid[VIR_UUID_STRING_BUFLEN]; =20 - if (virNetworkPortGetUUIDString(ports[i], uuid) < 0 || - VIR_STRDUP(ret[i], uuid) < 0) + if (virNetworkPortGetUUIDString(ports[i], uuid) < 0) goto error; =20 + ret[i] =3D g_strdup(uuid); + virNetworkPortFree(ports[i]); } VIR_FREE(ports); diff --git a/tools/virsh-completer-nodedev.c b/tools/virsh-completer-nodede= v.c index 899c199902..6b01941911 100644 --- a/tools/virsh-completer-nodedev.c +++ b/tools/virsh-completer-nodedev.c @@ -53,8 +53,7 @@ virshNodeDeviceNameCompleter(vshControl *ctl, for (i =3D 0; i < ndevs; i++) { const char *name =3D virNodeDeviceGetName(devs[i]); =20 - if (VIR_STRDUP(tmp[i], name) < 0) - goto cleanup; + tmp[i] =3D g_strdup(name); } =20 ret =3D g_steal_pointer(&tmp); @@ -81,10 +80,8 @@ virshNodeDeviceEventNameCompleter(vshControl *ctl G_GNUC= _UNUSED, if (VIR_ALLOC_N(tmp, VIR_NODE_DEVICE_EVENT_ID_LAST + 1) < 0) return NULL; =20 - for (i =3D 0; i < VIR_NODE_DEVICE_EVENT_ID_LAST; i++) { - if (VIR_STRDUP(tmp[i], virshNodeDeviceEventCallbacks[i].name) < 0) - return NULL; - } + for (i =3D 0; i < VIR_NODE_DEVICE_EVENT_ID_LAST; i++) + tmp[i] =3D g_strdup(virshNodeDeviceEventCallbacks[i].name); =20 ret =3D g_steal_pointer(&tmp); return ret; @@ -108,10 +105,8 @@ virshNodeDeviceCapabilityNameCompleter(vshControl *ctl, if (VIR_ALLOC_N(tmp, VIR_NODE_DEV_CAP_LAST + 1) < 0) return NULL; =20 - for (i =3D 0; i < VIR_NODE_DEV_CAP_LAST; i++) { - if (VIR_STRDUP(tmp[i], virNodeDevCapTypeToString(i)) < 0) - return NULL; - } + for (i =3D 0; i < VIR_NODE_DEV_CAP_LAST; i++) + tmp[i] =3D g_strdup(virNodeDevCapTypeToString(i)); =20 return virshCommaStringListComplete(cap_str, (const char **)tmp); } diff --git a/tools/virsh-completer-nwfilter.c b/tools/virsh-completer-nwfil= ter.c index 5029becf09..989a363847 100644 --- a/tools/virsh-completer-nwfilter.c +++ b/tools/virsh-completer-nwfilter.c @@ -51,8 +51,7 @@ virshNWFilterNameCompleter(vshControl *ctl, for (i =3D 0; i < nnwfilters; i++) { const char *name =3D virNWFilterGetName(nwfilters[i]); =20 - if (VIR_STRDUP(tmp[i], name) < 0) - goto cleanup; + tmp[i] =3D g_strdup(name); } =20 ret =3D g_steal_pointer(&tmp); @@ -91,8 +90,7 @@ virshNWFilterBindingNameCompleter(vshControl *ctl, for (i =3D 0; i < nbindings; i++) { const char *name =3D virNWFilterBindingGetPortDev(bindings[i]); =20 - if (VIR_STRDUP(tmp[i], name) < 0) - goto cleanup; + tmp[i] =3D g_strdup(name); } =20 ret =3D g_steal_pointer(&tmp); diff --git a/tools/virsh-completer-pool.c b/tools/virsh-completer-pool.c index ceb73eed06..bd9d9a9802 100644 --- a/tools/virsh-completer-pool.c +++ b/tools/virsh-completer-pool.c @@ -56,8 +56,7 @@ virshStoragePoolNameCompleter(vshControl *ctl, for (i =3D 0; i < npools; i++) { const char *name =3D virStoragePoolGetName(pools[i]); =20 - if (VIR_STRDUP(tmp[i], name) < 0) - goto cleanup; + tmp[i] =3D g_strdup(name); } =20 ret =3D g_steal_pointer(&tmp); @@ -84,10 +83,8 @@ virshPoolEventNameCompleter(vshControl *ctl G_GNUC_UNUSE= D, if (VIR_ALLOC_N(tmp, VIR_STORAGE_POOL_EVENT_ID_LAST + 1) < 0) return NULL; =20 - for (i =3D 0; i < VIR_STORAGE_POOL_EVENT_ID_LAST; i++) { - if (VIR_STRDUP(tmp[i], virshPoolEventCallbacks[i].name) < 0) - return NULL; - } + for (i =3D 0; i < VIR_STORAGE_POOL_EVENT_ID_LAST; i++) + tmp[i] =3D g_strdup(virshPoolEventCallbacks[i].name); =20 ret =3D g_steal_pointer(&tmp); return ret; @@ -111,10 +108,8 @@ virshPoolTypeCompleter(vshControl *ctl, if (VIR_ALLOC_N(tmp, VIR_STORAGE_POOL_LAST + 1) < 0) return NULL; =20 - for (i =3D 0; i < VIR_STORAGE_POOL_LAST; i++) { - if (VIR_STRDUP(tmp[i], virStoragePoolTypeToString(i)) < 0) - return NULL; - } + for (i =3D 0; i < VIR_STORAGE_POOL_LAST; i++) + tmp[i] =3D g_strdup(virStoragePoolTypeToString(i)); =20 return virshCommaStringListComplete(type_str, (const char **)tmp); } diff --git a/tools/virsh-completer-secret.c b/tools/virsh-completer-secret.c index a533ac178f..bb02577c82 100644 --- a/tools/virsh-completer-secret.c +++ b/tools/virsh-completer-secret.c @@ -52,9 +52,9 @@ virshSecretUUIDCompleter(vshControl *ctl, for (i =3D 0; i < nsecrets; i++) { char uuid[VIR_UUID_STRING_BUFLEN]; =20 - if (virSecretGetUUIDString(secrets[i], uuid) < 0 || - VIR_STRDUP(tmp[i], uuid) < 0) + if (virSecretGetUUIDString(secrets[i], uuid) < 0) goto cleanup; + tmp[i] =3D g_strdup(uuid); } =20 ret =3D g_steal_pointer(&tmp); @@ -81,10 +81,8 @@ virshSecretEventNameCompleter(vshControl *ctl G_GNUC_UNU= SED, if (VIR_ALLOC_N(tmp, VIR_SECRET_EVENT_ID_LAST + 1) < 0) return NULL; =20 - for (i =3D 0; i < VIR_SECRET_EVENT_ID_LAST; i++) { - if (VIR_STRDUP(tmp[i], virshSecretEventCallbacks[i].name) < 0) - return NULL; - } + for (i =3D 0; i < VIR_SECRET_EVENT_ID_LAST; i++) + tmp[i] =3D g_strdup(virshSecretEventCallbacks[i].name); =20 ret =3D g_steal_pointer(&tmp); return ret; diff --git a/tools/virsh-completer-snapshot.c b/tools/virsh-completer-snaps= hot.c index 14bd7bc6e4..aa1135d132 100644 --- a/tools/virsh-completer-snapshot.c +++ b/tools/virsh-completer-snapshot.c @@ -58,8 +58,7 @@ virshSnapshotNameCompleter(vshControl *ctl, for (i =3D 0; i < nsnapshots; i++) { const char *name =3D virDomainSnapshotGetName(snapshots[i]); =20 - if (VIR_STRDUP(tmp[i], name) < 0) - goto cleanup; + tmp[i] =3D g_strdup(name); } =20 ret =3D g_steal_pointer(&tmp); diff --git a/tools/virsh-completer-volume.c b/tools/virsh-completer-volume.c index f14570f23d..ad54261534 100644 --- a/tools/virsh-completer-volume.c +++ b/tools/virsh-completer-volume.c @@ -58,8 +58,7 @@ virshStorageVolNameCompleter(vshControl *ctl, for (i =3D 0; i < nvols; i++) { const char *name =3D virStorageVolGetName(vols[i]); =20 - if (VIR_STRDUP(tmp[i], name) < 0) - goto cleanup; + tmp[i] =3D g_strdup(name); } =20 ret =3D g_steal_pointer(&tmp); diff --git a/tools/virsh-completer.c b/tools/virsh-completer.c index dd03c98a16..7e4bd895e5 100644 --- a/tools/virsh-completer.c +++ b/tools/virsh-completer.c @@ -100,8 +100,7 @@ virshCommaStringListComplete(const char *input, if (input) { char *comma =3D NULL; =20 - if (VIR_STRDUP(inputCopy, input) < 0) - return NULL; + inputCopy =3D g_strdup(input); =20 if ((comma =3D strrchr(inputCopy, ','))) *comma =3D '\0'; @@ -119,9 +118,10 @@ virshCommaStringListComplete(const char *input, if (virStringListHasString((const char **)inputList, options[i])) continue; =20 - if ((inputCopy && virAsprintf(&ret[nret], "%s,%s", inputCopy, opti= ons[i]) < 0) || - (!inputCopy && VIR_STRDUP(ret[nret], options[i]) < 0)) + if (inputCopy && virAsprintf(&ret[nret], "%s,%s", inputCopy, optio= ns[i]) < 0) return NULL; + if (!inputCopy) + ret[nret] =3D g_strdup(options[i]); =20 nret++; } diff --git a/tools/virt-admin-completer.c b/tools/virt-admin-completer.c index b8602efaf9..25dacf51d8 100644 --- a/tools/virt-admin-completer.c +++ b/tools/virt-admin-completer.c @@ -53,8 +53,7 @@ vshAdmServerCompleter(vshControl *ctl, for (i =3D 0; i < nsrvs; i++) { const char *name =3D virAdmServerGetName(srvs[i]); =20 - if (VIR_STRDUP(ret[i], name) < 0) - goto error; + ret[i] =3D g_strdup(name); =20 virAdmServerFree(srvs[i]); } diff --git a/tools/virt-login-shell-helper.c b/tools/virt-login-shell-helpe= r.c index eb2b2dfe9e..ace8733968 100644 --- a/tools/virt-login-shell-helper.c +++ b/tools/virt-login-shell-helper.c @@ -102,10 +102,7 @@ static int virLoginShellGetShellArgv(virConfPtr conf, if (rv =3D=3D 0) { if (VIR_ALLOC_N(*shargv, 2) < 0) return -1; - if (VIR_STRDUP((*shargv)[0], "/bin/sh") < 0) { - VIR_FREE(*shargv); - return -1; - } + (*shargv)[0] =3D g_strdup("/bin/sh"); *shargvlen =3D 1; } else { *shargvlen =3D virStringListLength((const char *const *)shargv); @@ -347,10 +344,8 @@ main(int argc, char **argv) if (cmdstr) { if (VIR_REALLOC_N(shargv, shargvlen + 3) < 0) goto cleanup; - if (VIR_STRDUP(shargv[shargvlen++], "-c") < 0) - goto cleanup; - if (VIR_STRDUP(shargv[shargvlen++], cmdstr) < 0) - goto cleanup; + shargv[shargvlen++] =3D g_strdup("-c"); + shargv[shargvlen++] =3D g_strdup(cmdstr); shargv[shargvlen] =3D NULL; } =20 @@ -366,15 +361,13 @@ main(int argc, char **argv) goto cleanup; } tmp =3D strrchr(shcmd, '/'); - if (VIR_STRDUP(shargv[0], tmp) < 0) - goto cleanup; + shargv[0] =3D g_strdup(tmp); shargv[0][0] =3D '-'; =20 /* We're duping the string because the clearenv() * call will shortly release the pointer we get * back from getenv() right here */ - if (VIR_STRDUP(term, getenv("TERM")) < 0) - goto cleanup; + term =3D g_strdup(getenv("TERM")); =20 /* A fork is required to create new process in correct pid namespace. = */ if ((cpid =3D virFork()) < 0) diff --git a/tools/vsh-table.c b/tools/vsh-table.c index 8bd6d99778..c2271a4e2d 100644 --- a/tools/vsh-table.c +++ b/tools/vsh-table.c @@ -104,8 +104,7 @@ vshTableRowNew(const char *arg, va_list ap) while (arg) { char *tmp =3D NULL; =20 - if (VIR_STRDUP(tmp, arg) < 0) - goto error; + tmp =3D g_strdup(arg); =20 if (VIR_APPEND_ELEMENT(row->cells, row->ncells, tmp) < 0) { VIR_FREE(tmp); diff --git a/tools/vsh.c b/tools/vsh.c index a10a9625e4..3ef0031ee2 100644 --- a/tools/vsh.c +++ b/tools/vsh.c @@ -495,8 +495,7 @@ vshCmddefGetOption(vshControl *ctl, const vshCmdDef *cm= d, const char *name, opt->help =3D "string=3Dvalue": treat boolean flag as alias of option and its default value */ sa_assert(!alias); - if (VIR_STRDUP(alias, opt->help) < 0) - goto cleanup; + alias =3D g_strdup(opt->help); name =3D alias; if ((value =3D strchr(name, '=3D'))) { *value =3D '\0'; @@ -506,8 +505,7 @@ vshCmddefGetOption(vshControl *ctl, const vshCmdDef *cm= d, const char *name, opt->name); goto cleanup; } - if (VIR_STRDUP(*optstr, value + 1) < 0) - goto cleanup; + *optstr =3D g_strdup(value + 1); } continue; } @@ -3499,9 +3497,8 @@ cmdComplete(vshControl *ctl, const vshCmd *cmd) =20 vshReadlineInit(ctl); =20 - if (!(rl_line_buffer =3D virBufferContentAndReset(&buf)) && - VIR_STRDUP(rl_line_buffer, "") < 0) - goto cleanup; + if (!(rl_line_buffer =3D virBufferContentAndReset(&buf))) + rl_line_buffer =3D g_strdup(""); =20 /* rl_point is current cursor position in rl_line_buffer. * In our case it's at the end of the whole line. */ --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list