[libvirt] [PATCH 2/3] storage_backend_fs: Don't free a part of a structure on error
Osier Yang
jyang at redhat.com
Mon Jul 9 14:13:10 UTC 2012
On 2012年07月09日 21:21, Peter Krempa wrote:
> As the storage pool sources are stored in a list of structs, the pointer
> returned by virStoragePoolSourceListNewSource() shouldn't be freed as it
> points in the middle of a memory block. This combined with a regression
> that takes the error path every time on caused a double-free abort on
> the src struct in question.
> ---
> src/storage/storage_backend_fs.c | 2 --
> 1 files changed, 0 insertions(+), 2 deletions(-)
>
> diff --git a/src/storage/storage_backend_fs.c b/src/storage/storage_backend_fs.c
> index c736496..5e3da14 100644
> --- a/src/storage/storage_backend_fs.c
> +++ b/src/storage/storage_backend_fs.c
> @@ -218,10 +218,8 @@ virStorageBackendFileSystemNetFindPoolSourcesFunc(virStoragePoolObjPtr pool ATTR
> }
> src->format = VIR_STORAGE_POOL_NETFS_NFS;
>
> - src = NULL;
> ret = 0;
> cleanup:
> - virStoragePoolSourceFree(src);
> return ret;
> }
>
ACK
More information about the libvir-list
mailing list