Linux Btrfs filesystem development
 help / color / mirror / Atom feed
* [PATCH] Btrfs: fix possible memory leak in the find_parent_nodes()
@ 2013-05-08  8:10 Wang Shilong
  0 siblings, 0 replies; only message in thread
From: Wang Shilong @ 2013-05-08  8:10 UTC (permalink / raw)
  To: Linux Btrfs

In the find_parent_nodes(), if read_tree_block() fails, we can
not return directly, we should free some allocated memory otherwise
memory leak happens.

Signed-off-by: Wang Shilong <wangsl-fnst@cn.fujitsu.com>
---
Since Chris has already setup his pull, we'd like to send
another patch.
---
 fs/btrfs/backref.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/fs/btrfs/backref.c b/fs/btrfs/backref.c
index b4fb415..290e347 100644
--- a/fs/btrfs/backref.c
+++ b/fs/btrfs/backref.c
@@ -918,7 +918,8 @@ again:
 							   ref->parent, bsz, 0);
 				if (!eb || !extent_buffer_uptodate(eb)) {
 					free_extent_buffer(eb);
-					return -EIO;
+					ret = -EIO;
+					goto out;
 				}
 				ret = find_extent_in_eb(eb, bytenr,
 							*extent_item_pos, &eie);
-- 
1.7.7.6







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

only message in thread, other threads:[~2013-05-08  8:09 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-08  8:10 [PATCH] Btrfs: fix possible memory leak in the find_parent_nodes() Wang Shilong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox