On Wed, Jul 01, 2015 at 10:03:51 -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 use multiple loops to first count
> the number of matches, perform one allocation, and then again search
> for matches.  It's a 'n' string comparisons and allocations versus
> 2*'n' string comparisons and one allocation.

Another option would be to alloc *ret to nparams and fill only the
matched ones leaving a part of the array unused. Since this will be
used mainly in cases where n will be a rather small number (I think
libvirt is able to support ~250 disks max) the memory overhead won't be
noticable.

Peter

Attachment: signature.asc
Description: Digital signature

--
libvir-list mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/libvir-list

Reply via email to