summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorchandan <chandan@linux.vnet.ibm.com>2013-09-20 23:52:11 +0530
committerChris Mason <chris.mason@fusionio.com>2013-10-16 08:23:11 -0400
commit120e27d76fb5748db1160baf1efe0ceef59452f0 (patch)
tree172b7e368739955ff686670ab5e9bfbada290c17
parent1b10eaa8e1d453d65f571db47cd2207041835451 (diff)
btrfs-progs: clear_extent_bits: Fix memory leak.
The 'prealloc' extent_state structure is leaked for the case when the 'desired range' encapsulates/covers the 'extent range'. Signed-off-by: chandan <chandan@linux.vnet.ibm.com> Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
-rw-r--r--extent_io.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/extent_io.c b/extent_io.c
index acc4702e..1c481d5d 100644
--- a/extent_io.c
+++ b/extent_io.c
@@ -210,9 +210,11 @@ int clear_extent_bits(struct extent_io_tree *tree, u64 start,
int set = 0;
again:
- prealloc = alloc_extent_state();
- if (!prealloc)
- return -ENOMEM;
+ if (!prealloc) {
+ prealloc = alloc_extent_state();
+ if (!prealloc)
+ return -ENOMEM;
+ }
/*
* this search will find the extents that end after