From 0db197d8b2d2ab7214a2425c3c646e970e4085c8 Mon Sep 17 00:00:00 2001 From: Wang Sheng-Hui Date: Thu, 16 Aug 2012 20:15:56 +0800 Subject: 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 --- transaction.h | 1 + 1 file changed, 1 insertion(+) 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; -- cgit v1.2.3