[btrfs-devel][patch]Remove btrfs_path leak in btrfs_truncate_in_trans
Yan Zheng
yanzheng at 21cn.com
Mon Oct 22 01:25:17 PDT 2007
Hello,
The following two patch fix the leak in two different way. I prefer
the second one, but it doesn't show where the leak is. Please choose
the one you like to apply.
Regards
YZ
---
diff -r 9bf00d0c038f inode.c
--- a/inode.c Fri Oct 19 14:01:21 2007 -0400
+++ b/inode.c Mon Oct 22 12:51:56 2007 +0800
@@ -615,6 +615,7 @@ static int btrfs_truncate_in_trans(struc
} else {
break;
}
+ btrfs_release_path(root, path);
btrfs_set_key_type(&key, found_type);
continue;
}
---
diff -r 9bf00d0c038f inode.c
diff -r 9bf00d0c038f inode.c
--- a/inode.c Fri Oct 19 14:01:21 2007 -0400
+++ b/inode.c Mon Oct 22 16:19:26 2007 +0800
@@ -567,7 +567,7 @@ static int btrfs_truncate_in_trans(struc
key.type = (u8)-1;
while(1) {
- btrfs_init_path(path);
+ btrfs_release_path(root, path);
fi = NULL;
ret = btrfs_search_slot(trans, root, &key, path, -1, 1);
if (ret < 0) {
@@ -663,7 +663,6 @@ static int btrfs_truncate_in_trans(struc
} else {
break;
}
- btrfs_release_path(root, path);
if (found_extent) {
ret = btrfs_free_extent(trans, root, extent_start,
extent_num_bytes, 0);
More information about the Btrfs-devel
mailing list