diff options
author | Wang Sheng-Hui <shhuiw@gmail.com> | 2012-08-16 20:15:56 +0800 |
---|---|---|
committer | David Sterba <dsterba@suse.cz> | 2013-01-18 18:27:21 +0100 |
commit | 0db197d8b2d2ab7214a2425c3c646e970e4085c8 (patch) | |
tree | 916e30f5d9ef82a0e1286a9144a6c454e199d363 /transaction.h | |
parent | 133e4520eab88ee11b31afa4cbb012afdb0bbc28 (diff) |
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>
Diffstat (limited to 'transaction.h')
-rw-r--r-- | transaction.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/transaction.h b/transaction.h index a1070e0d..e8610b1d 100644 --- a/transaction.h +++ b/transaction.h @@ -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; |