[PATCH] fix mem-leak in netfilter
Linux Kernel Mailing List <[email protected]> Fri, 12 May 2006 18:59:46 GMT
| Newsgroups | gmane.linux.kernel.commits.2-4 |
|---|---|
| Message-ID | <[email protected]> |
commit ab23eb3f1e0f6844596a6dce141d01d0827b0da2 tree d505be903b53c2f512c5087ca91edd3e62d25dd3 parent 010896bc1ea1b8183dc0fbf6c4ec5fb6c86843d3 author Jesper Juhl <[email protected]> Sun, 07 May 2006 04:26:10 +0200 committer Willy TARREAU <willy@pcw.(none)> Sun, 07 May 2006 22:14:51 +0200 [PATCH] fix mem-leak in netfilter The Coverity checker spotted that we may leak 'hold' in net/ipv4/netfilter/ipt_recent.c::checkentry() when the following is true : if (!curr_table->status_proc) { ... if(!curr_table) { ... return 0; <-- here we leak. Simply moving an existing vfree(hold); up a bit avoids the possible leak. (please keep me on CC when replying since I'm not subscribed to netfilter-devel) Signed-off-by: Jesper Juhl <[email protected]> net/ipv4/netfilter/ipt_recent.c | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) diff --git a/net/ipv4/netfilter/ipt_recent.c b/net/ipv4/netfilter/ipt_recent.c index d379a26..25a4d61 100644 --- a/net/ipv4/netfilter/ipt_recent.c +++ b/net/ipv4/netfilter/ipt_recent.c @@ -820,6 +820,7 @@ #ifdef CONFIG_PROC_FS /* Create our proc 'status' entry. */ curr_table->status_proc = create_proc_entry(curr_table->name, ip_list_perms, proc_net_ipt_recent); if (!curr_table->status_proc) { + vfree(hold); printk(KERN_INFO RECENT_NAME ": checkentry: unable to allocate for /proc entry.\n"); /* Destroy the created table */ spin_lock_bh(&recent_lock); @@ -844,7 +845,6 @@ #endif spin_unlock_bh(&recent_lock); vfree(curr_table->time_info); vfree(curr_table->hash_table); - vfree(hold); vfree(curr_table->table); vfree(curr_table); return 0;