diff mbox

[10/10] btrfs-progs: return -ENOMEM properly in btrfs_read_block_groups()

Message ID 1445254680-11102-11-git-send-email-guaneryu@gmail.com (mailing list archive)
State Accepted
Headers show

Commit Message

Eryu Guan Oct. 19, 2015, 11:38 a.m. UTC
Breaking from the while loop makes ret overwritten to zero, goto error
label directly and return -ENOMEM.

Signed-off-by: Eryu Guan <guaneryu@gmail.com>
---
 extent-tree.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox

Patch

diff --git a/extent-tree.c b/extent-tree.c
index 0c8152a..97cf961 100644
--- a/extent-tree.c
+++ b/extent-tree.c
@@ -3255,7 +3255,7 @@  int btrfs_read_block_groups(struct btrfs_root *root)
 		cache = kzalloc(sizeof(*cache), GFP_NOFS);
 		if (!cache) {
 			ret = -ENOMEM;
-			break;
+			goto error;
 		}
 
 		read_extent_buffer(leaf, &cache->item,