summaryrefslogtreecommitdiff
path: root/volumes.c
diff options
context:
space:
mode:
authorLiu Bo <bo.li.liu@oracle.com>2014-07-07 22:35:53 +0800
committerDavid Sterba <dsterba@suse.cz>2014-08-22 15:04:50 +0200
commit81be797c264cfa2e4f8e76624aa678a8013338a4 (patch)
tree132533f7e84a31455b9fe9f239db391717ed6313 /volumes.c
parent23d7f6d9dc0aa42e30fe9642b4e0876354d2c02e (diff)
Btrfs-progs: fix Segmentation fault of btrfs-convert
Recently we merge a memory leak fix, which fails xfstests/btrfs/012, the cause is that it only frees @fs_devices but leaves it on the global fs_uuid list, which cause a 'Segmentation fault' over running command btrfs-convert. This fixes the problem. Signed-off-by: Liu Bo <bo.li.liu@oracle.com> Signed-off-by: David Sterba <dsterba@suse.cz>
Diffstat (limited to 'volumes.c')
-rw-r--r--volumes.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/volumes.c b/volumes.c
index f623a444..388c94e1 100644
--- a/volumes.c
+++ b/volumes.c
@@ -184,12 +184,18 @@ again:
seed_devices = fs_devices->seed;
fs_devices->seed = NULL;
if (seed_devices) {
+ struct btrfs_fs_devices *orig;
+
+ orig = fs_devices;
fs_devices = seed_devices;
+ list_del(&orig->list);
+ free(orig);
goto again;
+ } else {
+ list_del(&fs_devices->list);
+ free(fs_devices);
}
- list_del(&fs_devices->list);
- free(fs_devices);
return 0;
}