[libvirt] [PATCH 1/2] storage: plug iscsi memory leak

Eric Blake eblake at redhat.com
Fri Oct 21 22:46:38 UTC 2011


Detected by Coverity.  virStoragePoolSourceFree does not free the
actual passed-in pointer.  A bigger patch would be to rename it
virStoragePoolSourceClear to match behavior, or even split it into
two functions depending on needed behavior; but this is the minimal
fix to the one location out of eight that leaked memory.

* src/storage/storage_backend_iscsi.c
(virStorageBackendISCSIFindPoolSources): Free memory.
---
 src/storage/storage_backend_iscsi.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/src/storage/storage_backend_iscsi.c b/src/storage/storage_backend_iscsi.c
index 99e69c9..c6e782d 100644
--- a/src/storage/storage_backend_iscsi.c
+++ b/src/storage/storage_backend_iscsi.c
@@ -611,6 +611,7 @@ cleanup:
     VIR_FREE(targets);
     VIR_FREE(portal);
     virStoragePoolSourceFree(source);
+    VIR_FREE(source);
     return ret;
 }

-- 
1.7.4.4




More information about the libvir-list mailing list