Re: [libvirt] [PATCH 8/3] conf: avoid memory leak

2011-08-02 Thread Laine Stump

On 08/02/2011 03:50 PM, Eric Blake wrote:

Detected by Coverity.  Introduced in commit 85aa40e.



leak of meta - important point, since the thing being leaked doesn't 
show up anywhere in the diff.


ACK



* src/conf/domain_conf.c (virDomainDiskDefForeachPath): Plug leak.
---
  src/conf/domain_conf.c |6 +++---
  1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index e182cd6..010ce57 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -11315,7 +11315,7 @@ int virDomainDiskDefForeachPath(virDomainDiskDefPtr 
disk,
  virDomainDiskDefPathIterator iter,
  void *opaque)
  {
-virHashTablePtr paths;
+virHashTablePtr paths = NULL;
  int format;
  int ret = -1;
  size_t depth = 0;
@@ -11339,7 +11339,7 @@ int virDomainDiskDefForeachPath(virDomainDiskDefPtr 
disk,
  virDomainReportError(VIR_ERR_INTERNAL_ERROR,
   _(unknown disk format '%s' for %s),
   disk-driverType, disk-src);
-return -1;
+goto cleanup;
  }
  } else {
  if (allowProbing) {
@@ -11348,7 +11348,7 @@ int virDomainDiskDefForeachPath(virDomainDiskDefPtr 
disk,
  virDomainReportError(VIR_ERR_INTERNAL_ERROR,
   _(no disk format for %s and probing is 
disabled),
   disk-src);
-return -1;
+goto cleanup;
  }
  }



--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [PATCH 8/3] conf: avoid memory leak

2011-08-02 Thread Eric Blake

On 08/02/2011 02:53 PM, Laine Stump wrote:

On 08/02/2011 03:50 PM, Eric Blake wrote:

Detected by Coverity. Introduced in commit 85aa40e.



leak of meta - important point, since the thing being leaked doesn't
show up anywhere in the diff.

ACK


Good point.  I've now pushed 4-8, with this commit comment for 8:

conf: avoid memory leak on disk operations

Detected by Coverity.  Leak on meta introduced in commit 85aa40e.


--
Eric Blake   ebl...@redhat.com+1-801-349-2682
Libvirt virtualization library http://libvirt.org

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list