mirror of
https://github.com/kdave/btrfs-progs
synced 2024-12-23 14:45:19 +00:00
btrfs-progs: add malloc check in transaction.h/btrfs_start_transaction
For malloc may fail, we should check it before assign values to the struct btrfs_trans_handle *h. Signed-off-by: Wang Sheng-Hui <shhuiw@gmail.com>
This commit is contained in:
parent
133e4520ea
commit
0db197d8b2
@ -34,6 +34,7 @@ btrfs_start_transaction(struct btrfs_root *root, int num_blocks)
|
||||
struct btrfs_fs_info *fs_info = root->fs_info;
|
||||
struct btrfs_trans_handle *h = malloc(sizeof(*h));
|
||||
|
||||
BUG_ON(!h);
|
||||
BUG_ON(root->commit_root);
|
||||
BUG_ON(fs_info->running_transaction);
|
||||
fs_info->running_transaction = h;
|
||||
|
Loading…
Reference in New Issue
Block a user