projects
/
platform
/
upstream
/
btrfs-progs.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
133e452
)
btrfs-progs: add malloc check in transaction.h/btrfs_start_transaction
author
Wang Sheng-Hui
<shhuiw@gmail.com>
Thu, 16 Aug 2012 12:15:56 +0000
(20:15 +0800)
committer
David Sterba
<dsterba@suse.cz>
Fri, 18 Jan 2013 17:27:21 +0000
(18:27 +0100)
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>
transaction.h
patch
|
blob
|
history
diff --git
a/transaction.h
b/transaction.h
index
a1070e0
..
e8610b1
100644
(file)
--- 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;