]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
storage_backend_fs: Don't free a part of a structure on error
authorPeter Krempa <pkrempa@redhat.com>
Mon, 9 Jul 2012 12:10:05 +0000 (14:10 +0200)
committerCole Robinson <crobinso@redhat.com>
Sun, 12 Aug 2012 23:23:50 +0000 (19:23 -0400)
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.
(cherry picked from commit ab9c72ae9e55e7190f52ad1550624630a5c7f78b)

src/storage/storage_backend_fs.c

index 26bbc32e45ef2d03966b7647076e84fecc03419d..cf213b8c091c4f2e08f018463cb5e3d043973914 100644 (file)
@@ -213,10 +213,8 @@ virStorageBackendFileSystemNetFindPoolSourcesFunc(virStoragePoolObjPtr pool ATTR
     }
     src->format = VIR_STORAGE_POOL_NETFS_NFS;
 
-    src = NULL;
     ret = 0;
 cleanup:
-    virStoragePoolSourceFree(src);
     return ret;
 }