]> git.ipfire.org Git - thirdparty/libvirt.git/commit
util: Avoid Coverity FORWARD_NULL
authorJohn Ferlan <jferlan@redhat.com>
Wed, 1 Jul 2015 13:35:43 +0000 (09:35 -0400)
committerJohn Ferlan <jferlan@redhat.com>
Thu, 2 Jul 2015 10:30:27 +0000 (06:30 -0400)
commit2c05841246e30205d06cc186b1ba7434d2bae880
tree8d99c12a1d1d8cd94aa48048f714fbcab2830fe7
parent848ab685f74afae102e265108518095942ecb293
util: Avoid Coverity FORWARD_NULL

Avoid a false positive since Coverity find a path in virResizeN which
could return 0 prior to the allocation of memory and thus flags a
possible NULL dereference. Instead allocate the output buffer based
on 'nparams' and only fill it partially if need be - shouldn't be too
much a waste of space. Quicker than multiple VIR_RESIZE_N calls or
two loops of STREQ's sandwiched around a single VIR_ALLOC_N using
'n' matches from a first loop to generate the 'n' addresses to return

Signed-off-by: John Ferlan <jferlan@redhat.com>
src/util/virtypedparam.c