From 81be797c264cfa2e4f8e76624aa678a8013338a4 Mon Sep 17 00:00:00 2001 From: Liu Bo Date: Mon, 7 Jul 2014 22:35:53 +0800 Subject: 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 Signed-off-by: David Sterba --- volumes.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'volumes.c') 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; } -- cgit v1.2.3