Skip to contentSkip to conversation

btrfs-progs: clear_extent_bits: Fix memory leak.

PATCH New chandan 1 participant 1 message Sep 20, 2013 Btrfs file system

lore
Share & tools
lore

chandan

author
#0 lore raw

PATCH v2 1/1 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'.

---
v1->v2: Fix commit message.

---
 extent_io.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
extent_io.c +5 -3
index acc4702..1c481d5 100644
@@ -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
Signature · 1 line
1.8.3.1