[PATCH] btrfs-progs: clear_extent_bits: Fix memory leak.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The 'prealloc' extent_state structure is leaked for the case when an 'extent
range' encapsulates/covers the 'desired range'.

Signed-off-by: chandan <chandan@xxxxxxxxxxxxxxxxxx>
---
 extent_io.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/extent_io.c b/extent_io.c
index acc4702..1c481d5 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
-- 
1.8.3.1


--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Filesystem Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux