linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] btrfs-progs: clear_extent_bits: Fix memory leak.
@ 2013-09-20 17:59 chandan
  0 siblings, 0 replies; only message in thread
From: chandan @ 2013-09-20 17:59 UTC (permalink / raw)
  To: linux-btrfs; +Cc: sekharan

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

Signed-off-by: chandan <chandan@linux.vnet.ibm.com>
---
 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



^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2013-09-20 17:59 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-20 17:59 [PATCH] btrfs-progs: clear_extent_bits: Fix memory leak chandan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).