summaryrefslogtreecommitdiff
path: root/disk-io.c
diff options
context:
space:
mode:
authorKenji Okimoto <okimoto@clear-code.com>2012-11-15 13:47:51 +0900
committerDavid Sterba <dsterba@suse.cz>2013-01-17 18:27:55 +0100
commit1cce8d72f2d0d00bd5c9322b16176de0fb56aff6 (patch)
treeea5b69c8e8d3c4df4aad8740841c12a482f8e637 /disk-io.c
parent057d6ea34cf350d13be50fde9b024a9dacf548fe (diff)
btrfs-progs: check malloc() result
Signed-off-by: Kenji Okimoto <okimoto@clear-code.com>
Diffstat (limited to 'disk-io.c')
-rw-r--r--disk-io.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/disk-io.c b/disk-io.c
index 32f45dcd..c4d4631d 100644
--- a/disk-io.c
+++ b/disk-io.c
@@ -458,6 +458,9 @@ static int find_and_setup_log_root(struct btrfs_root *tree_root,
u64 blocknr = btrfs_super_log_root(disk_super);
struct btrfs_root *log_root = malloc(sizeof(struct btrfs_root));
+ if (!log_root)
+ return -ENOMEM;
+
if (blocknr == 0) {
free(log_root);
return 0;