2011-03-15 10:25:19 +01:00
|
|
|
commit a2fe2e1b978f724f53d025461e65adb4e030d043
|
|
|
|
Author: Dirk Mueller <dmueller@suse.de>
|
|
|
|
Date: Thu Dec 16 20:40:34 2010 +0100
|
2010-03-26 16:47:29 +01:00
|
|
|
|
2011-03-15 10:25:19 +01:00
|
|
|
[PATCH] Plug Memory leak in find_and_setup_log_root()
|
|
|
|
|
|
|
|
The error path forgets to free a previously allocated
|
|
|
|
memory structure.
|
2010-03-26 16:47:29 +01:00
|
|
|
|
|
|
|
diff --git a/disk-io.c b/disk-io.c
|
2011-03-15 10:25:19 +01:00
|
|
|
index a6e1000..2b5e1d5 100644
|
2010-03-26 16:47:29 +01:00
|
|
|
--- a/disk-io.c
|
|
|
|
+++ b/disk-io.c
|
2011-03-15 10:25:19 +01:00
|
|
|
@@ -423,11 +423,13 @@ static int find_and_setup_log_root(struct btrfs_root *tree_root,
|
2010-03-26 16:47:29 +01:00
|
|
|
{
|
|
|
|
u32 blocksize;
|
|
|
|
u64 blocknr = btrfs_super_log_root(disk_super);
|
|
|
|
- struct btrfs_root *log_root = malloc(sizeof(struct btrfs_root));
|
2011-03-15 10:25:19 +01:00
|
|
|
+ struct btrfs_root *log_root;
|
2010-03-26 16:47:29 +01:00
|
|
|
|
|
|
|
if (blocknr == 0)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
+ log_root = malloc(sizeof(struct btrfs_root));
|
2011-03-15 10:25:19 +01:00
|
|
|
+
|
2010-03-26 16:47:29 +01:00
|
|
|
blocksize = btrfs_level_size(tree_root,
|
|
|
|
btrfs_super_log_root_level(disk_super));
|
|
|
|
|