[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20121231152312.GF7564@quack.suse.cz>
Date: Mon, 31 Dec 2012 16:23:12 +0100
From: Jan Kara <jack@...e.cz>
To: Chen Gang <gang.chen@...anux.com>
Cc: akpm@...ux-foundation.org, jack@...e.cz, linux-ext4@...r.kernel.org
Subject: Re: [PATCH] fs/jbd: set pointer = NULL, after kfree it.
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@...anux.com>
> ---
> 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@...e.cz>
SUSE Labs, CR
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists