[libvirt] [PATCH 00/14] Resolve some RESOURCE_LEAK errors found by Coverity

John Ferlan jferlan at redhat.com
Wed Jan 9 14:54:06 UTC 2013


This patch addresses some "Error: RESOURCE_LEAK (CWE-404)" errors found by
Coverity. There are 100+ remaining; however, many seem to be false positives
which will be addressed in a separate patch.

The esx_driver.c and hyperv_driver.c changes could be tagged as false
positives; however, the changes made will avoid the Coverity error since
the freeing of the resource marked isn't based soley on the result.

The phyp_driver.c changes in openSSHSession() and its callers were the most
involved since the code with now use connection_data->sock in order to track
the socket so as to allow it to be closed once done with it. Of interest in
this change is that phypExec() used connection_data->sock even though it
had never been initialized.

John Ferlan (14):
  phyp: Resolve some file descriptor leaks
  esx: Address resource leak found by Coverity
  storage: Resolve resource leak using 'vol' buffer
  util: Resolve resource leak for 'res' in virSetInherit error path.
  locking: Resolve resource leak with 'dir' on non error path
  rpc: Avoid resource leak of 'socks' if any object append fails
  uml: Avoid resource leak of event in umlInofityEvent
  test: Resource resource leak with 'tmp_vols'
  storage: Resource resource leak using 'tmp_vols'
  interface: Resolve resource leak wth 'tmp_iface_objs'
  xen: Resource resource leak with 'cpuset'
  parallels: Resolve some resource leaks
  storage: Need to also VIR_FREE(reg)
  hyperv: Address resource leak found by Coverityo

 src/esx/esx_driver.c                    |  8 ++++----
 src/hyperv/hyperv_driver.c              | 10 +++++-----
 src/interface/interface_backend_netcf.c |  1 +
 src/locking/lock_driver_sanlock.c       |  1 +
 src/parallels/parallels_driver.c        | 30 +++++++++++++++++++-----------
 src/phyp/phyp_driver.c                  | 19 ++++++++++++++-----
 src/rpc/virnetserverservice.c           |  6 +++---
 src/storage/storage_backend_logical.c   |  1 +
 src/storage/storage_backend_rbd.c       | 13 ++++++++++---
 src/storage/storage_driver.c            |  1 +
 src/test/test_driver.c                  |  1 +
 src/uml/uml_driver.c                    |  6 ++++--
 src/util/virlockspace.c                 |  1 +
 src/xen/xend_internal.c                 | 12 ++++++------
 14 files changed, 71 insertions(+), 39 deletions(-)

-- 
1.7.11.7




More information about the libvir-list mailing list