btrfs-progs: check malloc() result

Signed-off-by: Kenji Okimoto <okimoto@clear-code.com>
master
Kenji Okimoto 2012-11-15 13:47:51 +09:00 committed by David Sterba
parent 057d6ea34c
commit 1cce8d72f2
1 changed files with 3 additions and 0 deletions

View File

@ -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;