]> git.ipfire.org Git - thirdparty/libvirt.git/commit
virsh: Resolve Coverity NEGATIVE_RETURNS
authorJohn Ferlan <jferlan@redhat.com>
Thu, 4 Sep 2014 21:08:48 +0000 (17:08 -0400)
committerJohn Ferlan <jferlan@redhat.com>
Fri, 12 Sep 2014 10:12:50 +0000 (06:12 -0400)
commitbe365d8dff1aec37b9a487ca31abce3f904419dd
tree632db8331864ffa6943e759f83c31cf2c39dbba6
parent58252332eb365b93ba1d1067b3e162668eb2f1aa
virsh: Resolve Coverity NEGATIVE_RETURNS

Coverity notes that after we VIR_ALLOC_N(params, nparams) a failed call to
virDomainGetCPUStats could result in nparams being set to -1. In that case,
the subsequent virTypedParamsFree in cleanup will pass -1 which isn't good.

Use the returned value as the number of stats to display in the loop as
it will be the value reported from the hypervisor and may be less than
nparams which is OK

Signed-off-by: John Ferlan <jferlan@redhat.com>
tools/virsh-domain.c