I got answer from someone on the Coverity boards regarding a false positive
related to how VIR_FREE() was operating when passed an address of an address
to some memory, see my note from last week:
https://www.redhat.com/archives/libvir-list/2013-January/msg01353.html
Essentially the issue is the "?:" construct in the VIR_FREE() macro and
Coverity taking the "else" condition as a possible path even though it
technically couldn't happen ((1) ? xxx : yyy). The suggestion made was
to remove the "?:", but since this only happens in the static analysis
case I used the existing STATIC_ANALYSIS build directive. This change
resolved about 100 false positives.
In doing this, Coverity uncovered a few more uninitialized variables prior
to VIR_FREE calls and a couple of instances where VIR_FREE was being called
on already free'd memory plus one instance where a pointer to free'd memory
was being returned (in qemumonitortestutils.c).
John Ferlan (14):
viralloc: Adjust definition of VIR_FREE() for Coverity
conf: Need to initialize variables before VIR_FREE
virnetserver: Need to initialize 'sigdata'
virnetsockettest: Need to initialize 'path'
virnetdev: Need to initialize 'pciConfigAddr'
commandtest: Need to initialize 'errbuf'
virfile: Need to initialize 'looppath'
lxc: Need to initialize 'dst'
virsh: Need to intialize 'str'
storage: Need to initialize 'zerobuf'
interface: Need to initialize 'ifaces_list'
security: Need to initialize 'sens'
virkeepalive: Remove erroneous VIR_FREE(msg)
tests: Need to initialize 'test' properly on error path
src/conf/domain_audit.c | 4 ++--
src/interface/interface_backend_udev.c | 2 +-
src/lxc/lxc_driver.c | 4 ++--
src/rpc/virkeepalive.c | 1 -
src/rpc/virnetserver.c | 2 +-
src/security/security_selinux.c | 2 +-
src/storage/storage_backend.c | 2 +-
src/util/viralloc.h | 11 ++++++++++-
src/util/virfile.c | 2 +-
src/util/virnetdev.c | 2 +-
tests/commandtest.c | 2 +-
tests/qemumonitortestutils.c | 1 +
tests/virnetsockettest.c | 4 ++--
tools/virsh.c | 2 +-
14 files changed, 25 insertions(+), 16 deletions(-)
--
1.7.11.7