linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] fs/jbd: set pointer = NULL, after kfree it.
@ 2012-12-24  2:39 Chen Gang
  2012-12-31 15:23 ` Jan Kara
  0 siblings, 1 reply; 3+ messages in thread
From: Chen Gang @ 2012-12-24  2:39 UTC (permalink / raw)
  To: akpm, jack; +Cc: linux-ext4


  set pointer = NULL, after call journal_destroy_revoke_table.
    in journal_destroy_revoke_table, it will call kfree to free the buffer.

Signed-off-by: Chen Gang <gang.chen@asianux.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

^ permalink raw reply related	[flat|nested] 3+ messages in thread
* Re: [PATCH] fs/jbd: set pointer = NULL, after kfree it.
@ 2013-01-04  1:37 Chen Gang
  0 siblings, 0 replies; 3+ messages in thread
From: Chen Gang @ 2013-01-04  1:37 UTC (permalink / raw)
  To: jack; +Cc: akpm, linux-ext4


------- Original Message -------
From: Jan Kara <jack@suse.cz>
To: Chen Gang <gang.chen@asianux.com>
Cc: akpm@linux-foundation.org; jack@suse.cz;linux-ext4@vger.kernel.org
Sent: Mon, 31 Dec 2012 16:23:12 +0100
Subject: Re: [PATCH] fs/jbd: set pointer = NULL, after kfree it.

>   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?

  ok, I can understand.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-01-04  1:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-12-24  2:39 [PATCH] fs/jbd: set pointer = NULL, after kfree it Chen Gang
2012-12-31 15:23 ` Jan Kara
  -- strict thread matches above, loose matches on Subject: below --
2013-01-04  1:37 Chen Gang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).