Skip to contentSkip to conversation

Btrfs: fix possible memory leak in the find_parent_nodes()

PATCH New Wang Shilong 1 participant 1 message May 8, 2013 Btrfs file system

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Btrfs: fix possible memory leak in the find_parent_nodes()

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.

---
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(-)
fs/btrfs/backref.c +2 -1
index b4fb415..290e347 100644
@@ -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);
Signature · 1 line
1.7.7.6