diff options
author | Andrew Morton <akpm@osdl.org> | 2006-06-23 05:05:32 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-06-23 10:43:05 -0400 |
commit | e6022603b9aa7d61d20b392e69edcdbbc1789969 (patch) | |
tree | f94b059e312ea7b2f3c4d0b01939e868ed525fb0 | |
parent | 304c4c841a31c780a45d65e389b07706babf5d36 (diff) |
[PATCH] ext3_clear_inode(): avoid kfree(NULL)
Steven Rostedt <rostedt@goodmis.org> points out that `rsv' here is usually
NULL, so we should avoid calling kfree().
Also, fix up some nearby whitespace damage.
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r-- | fs/ext3/super.c | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/fs/ext3/super.c b/fs/ext3/super.c index e08b6439617c..1a198b3985c9 100644 --- a/fs/ext3/super.c +++ b/fs/ext3/super.c | |||
@@ -499,20 +499,21 @@ static void ext3_clear_inode(struct inode *inode) | |||
499 | { | 499 | { |
500 | struct ext3_block_alloc_info *rsv = EXT3_I(inode)->i_block_alloc_info; | 500 | struct ext3_block_alloc_info *rsv = EXT3_I(inode)->i_block_alloc_info; |
501 | #ifdef CONFIG_EXT3_FS_POSIX_ACL | 501 | #ifdef CONFIG_EXT3_FS_POSIX_ACL |
502 | if (EXT3_I(inode)->i_acl && | 502 | if (EXT3_I(inode)->i_acl && |
503 | EXT3_I(inode)->i_acl != EXT3_ACL_NOT_CACHED) { | 503 | EXT3_I(inode)->i_acl != EXT3_ACL_NOT_CACHED) { |
504 | posix_acl_release(EXT3_I(inode)->i_acl); | 504 | posix_acl_release(EXT3_I(inode)->i_acl); |
505 | EXT3_I(inode)->i_acl = EXT3_ACL_NOT_CACHED; | 505 | EXT3_I(inode)->i_acl = EXT3_ACL_NOT_CACHED; |
506 | } | 506 | } |
507 | if (EXT3_I(inode)->i_default_acl && | 507 | if (EXT3_I(inode)->i_default_acl && |
508 | EXT3_I(inode)->i_default_acl != EXT3_ACL_NOT_CACHED) { | 508 | EXT3_I(inode)->i_default_acl != EXT3_ACL_NOT_CACHED) { |
509 | posix_acl_release(EXT3_I(inode)->i_default_acl); | 509 | posix_acl_release(EXT3_I(inode)->i_default_acl); |
510 | EXT3_I(inode)->i_default_acl = EXT3_ACL_NOT_CACHED; | 510 | EXT3_I(inode)->i_default_acl = EXT3_ACL_NOT_CACHED; |
511 | } | 511 | } |
512 | #endif | 512 | #endif |
513 | ext3_discard_reservation(inode); | 513 | ext3_discard_reservation(inode); |
514 | EXT3_I(inode)->i_block_alloc_info = NULL; | 514 | EXT3_I(inode)->i_block_alloc_info = NULL; |
515 | kfree(rsv); | 515 | if (unlikely(rsv)) |
516 | kfree(rsv); | ||
516 | } | 517 | } |
517 | 518 | ||
518 | static inline void ext3_show_quota_options(struct seq_file *seq, struct super_block *sb) | 519 | static inline void ext3_show_quota_options(struct seq_file *seq, struct super_block *sb) |