aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Sterba <dsterba@suse.com>2016-07-28 02:04:30 +0200
committerDavid Sterba <dsterba@suse.com>2016-07-28 14:08:30 +0200
commit02e22dbc1c76f46ad0916a4e843577fe9cd0f645 (patch)
treedf6b486bfcea9d5a4619f4cc787f4053d70535ff
parent002812542c29d51db6e1812b35a43540d21d418c (diff)
downloadbtrfs-progs-02e22dbc1c76f46ad0916a4e843577fe9cd0f645.tar.gz
btrfs-progs-02e22dbc1c76f46ad0916a4e843577fe9cd0f645.tar.xz
btrfs-progs-02e22dbc1c76f46ad0916a4e843577fe9cd0f645.zip
btrfs-progs: handle memory allocation error in __alloc_extent_buffer
Drop the BUG() as all callers handle errors. Signed-off-by: David Sterba <dsterba@suse.com>
-rw-r--r--extent_io.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/extent_io.c b/extent_io.c
index d956c57..c455b5a 100644
--- a/extent_io.c
+++ b/extent_io.c
@@ -540,10 +540,8 @@ static struct extent_buffer *__alloc_extent_buffer(struct extent_io_tree *tree,
struct extent_buffer *eb;
eb = calloc(1, sizeof(struct extent_buffer) + blocksize);
- if (!eb) {
- BUG();
+ if (!eb)
return NULL;
- }
eb->start = bytenr;
eb->len = blocksize;
@@ -564,7 +562,7 @@ struct extent_buffer *btrfs_clone_extent_buffer(struct extent_buffer *src)
struct extent_buffer *new;
new = __alloc_extent_buffer(NULL, src->start, src->len);
- if (new == NULL)
+ if (!new)
return NULL;
copy_extent_buffer(new, src, 0, 0, src->len);