From patchwork Mon Dec 24 02:39:07 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chen Gang X-Patchwork-Id: 208016 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 72A7C2C008C for ; Mon, 24 Dec 2012 13:38:16 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752427Ab2LXCiO (ORCPT ); Sun, 23 Dec 2012 21:38:14 -0500 Received: from intranet.asianux.com ([58.214.24.6]:53480 "EHLO intranet.asianux.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752302Ab2LXCiO (ORCPT ); Sun, 23 Dec 2012 21:38:14 -0500 Received: by intranet.asianux.com (Postfix, from userid 103) id 96C7018402AD; Mon, 24 Dec 2012 10:38:12 +0800 (CST) X-Spam-Score: -100.8 X-Spam-Checker-Version: SpamAssassin 3.1.9 (2007-02-13) on intranet.asianux.com X-Spam-Level: X-Spam-Status: No, score=-100.8 required=5.0 tests=AWL,BAYES_00, RATWARE_GECKO_BUILD,USER_IN_WHITELIST autolearn=no version=3.1.9 Received: from [10.1.0.143] (unknown [219.143.36.82]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by intranet.asianux.com (Postfix) with ESMTP id 465BF184024F; Mon, 24 Dec 2012 10:38:12 +0800 (CST) Message-ID: <50D7C04B.6010109@asianux.com> Date: Mon, 24 Dec 2012 10:39:07 +0800 From: Chen Gang User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:15.0) Gecko/20120911 Thunderbird/15.0.1 MIME-Version: 1.0 To: akpm@linux-foundation.org, jack@suse.cz CC: linux-ext4@vger.kernel.org Subject: [PATCH] fs/jbd: set pointer = NULL, after kfree it. Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org 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 --- 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; + } }