summaryrefslogtreecommitdiff
path: root/disk-io.c
diff options
context:
space:
mode:
authorDavid Sterba <dsterba@suse.com>2016-08-31 20:38:46 +0200
committerDavid Sterba <dsterba@suse.com>2016-09-21 14:12:38 +0200
commit1ef93ea8632b89598d7723a04a2d268b70333168 (patch)
tree48e911e91131e2023534ae8dbd652d245a039f15 /disk-io.c
parentb318553f33dc59b6afdc7d264dcfbfe835ccc3d4 (diff)
btrfs-progs: handle errors from btrfs_alloc_path
All functions already return an error condition, so the callers should expect that. Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'disk-io.c')
-rw-r--r--disk-io.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/disk-io.c b/disk-io.c
index 2fd3330f..b7202fab 100644
--- a/disk-io.c
+++ b/disk-io.c
@@ -739,7 +739,11 @@ struct btrfs_root *btrfs_read_fs_root_no_cache(struct btrfs_fs_info *fs_info,
root, fs_info, location->objectid);
path = btrfs_alloc_path();
- BUG_ON(!path);
+ if (!path) {
+ free(root);
+ return ERR_PTR(-ENOMEM);
+ }
+
ret = btrfs_search_slot(NULL, tree_root, location, path, 0, 0);
if (ret != 0) {
if (ret > 0)