2004-09-01 16:50:05

by Dave Jones

[permalink] [raw]
Subject: [PATCH] Fix possible leaks in netfilter.

Spotted with the source checker from Coverity.com.

Signed-off-by: Dave Jones <[email protected]>


diff -urpN --exclude-from=/home/davej/.exclude bk-linus/net/ipv4/netfilter/ipt_recent.c linux-2.6/net/ipv4/netfilter/ipt_recent.c
--- bk-linus/net/ipv4/netfilter/ipt_recent.c 2004-08-24 00:02:41.000000000 +0100
+++ linux-2.6/net/ipv4/netfilter/ipt_recent.c 2004-09-01 13:31:21.000000000 +0100
@@ -827,6 +827,7 @@ checkentry(const char *tablename,
if(debug) printk(KERN_INFO RECENT_NAME ": checkentry() create_proc failed, no tables.\n");
#endif
spin_unlock_bh(&recent_lock);
+ vfree(hold);
return -ENOMEM;
}
while( strncmp(info->name,curr_table->name,IPT_RECENT_NAME_LEN) && (last_table = curr_table) && (curr_table = curr_table->next) );
@@ -835,6 +836,7 @@ checkentry(const char *tablename,
if(debug) printk(KERN_INFO RECENT_NAME ": checkentry() create_proc failed, table already destroyed.\n");
#endif
spin_unlock_bh(&recent_lock);
+ vfree(hold);
return -ENOMEM;
}
if(last_table) last_table->next = curr_table->next; else r_tables = curr_table->next;