[libvirt] [PATCH] storage: Fix the memory leak

2014-01-23 Thread Osier Yang
The return value of virGetFCHostNameByWWN is a strdup'ed string. Also add comments to declare that the caller should take care of freeing it. --- src/storage/storage_backend_scsi.c | 15 ++- src/util/virutil.c | 5 - 2 files changed, 14 insertions(+), 6

Re: [libvirt] [PATCH] storage: Fix the memory leak

2014-01-23 Thread Martin Kletzander
On Thu, Jan 23, 2014 at 06:23:32PM +0800, Osier Yang wrote: The return value of virGetFCHostNameByWWN is a strdup'ed string. Also add comments to declare that the caller should take care of freeing it. --- src/storage/storage_backend_scsi.c | 15 ++- src/util/virutil.c

Re: [libvirt] [PATCH] storage: Fix the memory leak

2014-01-23 Thread Osier Yang
On 23/01/14 19:06, Martin Kletzander wrote: On Thu, Jan 23, 2014 at 06:23:32PM +0800, Osier Yang wrote: The return value of virGetFCHostNameByWWN is a strdup'ed string. Also add comments to declare that the caller should take care of freeing it. --- src/storage/storage_backend_scsi.c | 15

Re: [libvirt] [PATCH] storage: fix unlikely memory leak in rbd backend

2013-03-22 Thread Laine Stump
On 03/18/2013 06:28 PM, Eric Blake wrote: On 03/18/2013 02:07 PM, Laine Stump wrote: virStorageBackendRBDRefreshPool() first allocates an array big enough to hold 1024 names, then calls rbd_list(), which returns ERANGE if the array isn't big enough. When that happens, the VIR_ALLOC_N is called

[libvirt] [PATCH] storage: fix unlikely memory leak in rbd backend

2013-03-18 Thread Laine Stump
virStorageBackendRBDRefreshPool() first allocates an array big enough to hold 1024 names, then calls rbd_list(), which returns ERANGE if the array isn't big enough. When that happens, the VIR_ALLOC_N is called again with a larger size. Unfortunately, the original array isn't freed before

Re: [libvirt] [PATCH] storage: fix unlikely memory leak in rbd backend

2013-03-18 Thread Eric Blake
On 03/18/2013 02:07 PM, Laine Stump wrote: virStorageBackendRBDRefreshPool() first allocates an array big enough to hold 1024 names, then calls rbd_list(), which returns ERANGE if the array isn't big enough. When that happens, the VIR_ALLOC_N is called again with a larger size. Unfortunately,

Re: [libvirt] [PATCH] storage: fix unlikely memory leak in rbd backend

2013-03-18 Thread John Ferlan
On 03/18/2013 04:07 PM, Laine Stump wrote: virStorageBackendRBDRefreshPool() first allocates an array big enough to hold 1024 names, then calls rbd_list(), which returns ERANGE if the array isn't big enough. When that happens, the VIR_ALLOC_N is called again with a larger size. Unfortunately,