linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Btrfs-progs: fix Segmentation fault of btrfs-convert
@ 2014-07-07 14:35 Liu Bo
  0 siblings, 0 replies; only message in thread
From: Liu Bo @ 2014-07-07 14:35 UTC (permalink / raw)
  To: linux-btrfs

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>
---
 volumes.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/volumes.c b/volumes.c
index a61928c..8b827fa 100644
--- a/volumes.c
+++ b/volumes.c
@@ -184,11 +184,17 @@ 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);
 	}
-
-	free(fs_devices);
 	return 0;
 }
 
-- 
1.8.1.4


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2014-07-07 14:36 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-07-07 14:35 [PATCH] Btrfs-progs: fix Segmentation fault of btrfs-convert Liu Bo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).