Re: [PATCH] fs/jbd: set pointer = NULL, after kfree it.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon 24-12-12 10:39:07, Chen Gang wrote:
> 
>   set pointer = NULL, after call journal_destroy_revoke_table.
>     in journal_destroy_revoke_table, it will call kfree to free the buffer.
  The journal structure will get freed immediately after we return from
journal_init_revoke() (in case it failed) or journal_destroy_revoke() so I
don't see a point in setting the pointers to NULL. Or do I miss something?

								Honza
> 
> Signed-off-by: Chen Gang <gang.chen@xxxxxxxxxxx>
> ---
>  fs/jbd/revoke.c |    9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/jbd/revoke.c b/fs/jbd/revoke.c
> index 25c713e..d6457b0 100644
> --- a/fs/jbd/revoke.c
> +++ b/fs/jbd/revoke.c
> @@ -295,6 +295,7 @@ int journal_init_revoke(journal_t *journal, int hash_size)
>  
>  fail1:
>  	journal_destroy_revoke_table(journal->j_revoke_table[0]);
> +	journal->j_revoke_table[0] = NULL;
>  fail0:
>  	return -ENOMEM;
>  }
> @@ -303,10 +304,14 @@ fail0:
>  void journal_destroy_revoke(journal_t *journal)
>  {
>  	journal->j_revoke = NULL;
> -	if (journal->j_revoke_table[0])
> +	if (journal->j_revoke_table[0]) {
>  		journal_destroy_revoke_table(journal->j_revoke_table[0]);
> -	if (journal->j_revoke_table[1])
> +		journal->j_revoke_table[0] = NULL;
> +	}
> +	if (journal->j_revoke_table[1]) {
>  		journal_destroy_revoke_table(journal->j_revoke_table[1]);
> +		journal->j_revoke_table[1] = NULL;
> +	}
>  }
>  
>  
> -- 
> 1.7.10.4
-- 
Jan Kara <jack@xxxxxxx>
SUSE Labs, CR
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Reiser Filesystem Development]     [Ceph FS]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite National Park]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]     [Linux Media]

  Powered by Linux