[libvirt] [PATCHv2 7/7 util: Avoid Coverity FORWARD_NULL

Peter Krempa pkrempa at redhat.com
Thu Jul 2 05:34:07 UTC 2015


On Wed, Jul 01, 2015 at 12:41:23 -0400, John Ferlan wrote:
> 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 at redhat.com>
> ---
> 
> Difference to v1: Use single VIR_ALLOC_N of nparams and one loop as
> suggested in review
> 
>  src/util/virtypedparam.c | 9 +++------
>  1 file changed, 3 insertions(+), 6 deletions(-)

ACK,

Peter
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20150702/f82df79e/attachment-0001.sig>


More information about the libvir-list mailing list