Commit 68d31872 authored by James Lamanna's avatar James Lamanna Committed by David S. Miller

[EBTABLES]: vfree() checking cleanups

From: jlamanna@gmail.com

ebtables.c vfree() checking cleanups.

Signed-off by: James Lamanna <jlamanna@gmail.com>
Signed-off-by: default avatarDomen Puncer <domen@coderock.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 285b3afe
...@@ -859,8 +859,7 @@ static int translate_table(struct ebt_replace *repl, ...@@ -859,8 +859,7 @@ static int translate_table(struct ebt_replace *repl,
if (repl->valid_hooks & (1 << i)) if (repl->valid_hooks & (1 << i))
if (check_chainloops(newinfo->hook_entry[i], if (check_chainloops(newinfo->hook_entry[i],
cl_s, udc_cnt, i, newinfo->entries)) { cl_s, udc_cnt, i, newinfo->entries)) {
if (cl_s) vfree(cl_s);
vfree(cl_s);
return -EINVAL; return -EINVAL;
} }
...@@ -883,8 +882,7 @@ static int translate_table(struct ebt_replace *repl, ...@@ -883,8 +882,7 @@ static int translate_table(struct ebt_replace *repl,
EBT_ENTRY_ITERATE(newinfo->entries, newinfo->entries_size, EBT_ENTRY_ITERATE(newinfo->entries, newinfo->entries_size,
ebt_cleanup_entry, &i); ebt_cleanup_entry, &i);
} }
if (cl_s) vfree(cl_s);
vfree(cl_s);
return ret; return ret;
} }
...@@ -1030,8 +1028,7 @@ static int do_replace(void __user *user, unsigned int len) ...@@ -1030,8 +1028,7 @@ static int do_replace(void __user *user, unsigned int len)
} }
vfree(table); vfree(table);
if (counterstmp) vfree(counterstmp);
vfree(counterstmp);
return ret; return ret;
free_unlock: free_unlock:
...@@ -1040,8 +1037,7 @@ free_iterate: ...@@ -1040,8 +1037,7 @@ free_iterate:
EBT_ENTRY_ITERATE(newinfo->entries, newinfo->entries_size, EBT_ENTRY_ITERATE(newinfo->entries, newinfo->entries_size,
ebt_cleanup_entry, NULL); ebt_cleanup_entry, NULL);
free_counterstmp: free_counterstmp:
if (counterstmp) vfree(counterstmp);
vfree(counterstmp);
/* can be initialized in translate_table() */ /* can be initialized in translate_table() */
if (newinfo->chainstack) { if (newinfo->chainstack) {
for (i = 0; i < num_possible_cpus(); i++) for (i = 0; i < num_possible_cpus(); i++)
...@@ -1049,11 +1045,9 @@ free_counterstmp: ...@@ -1049,11 +1045,9 @@ free_counterstmp:
vfree(newinfo->chainstack); vfree(newinfo->chainstack);
} }
free_entries: free_entries:
if (newinfo->entries) vfree(newinfo->entries);
vfree(newinfo->entries);
free_newinfo: free_newinfo:
if (newinfo) vfree(newinfo);
vfree(newinfo);
return ret; return ret;
} }
...@@ -1213,8 +1207,7 @@ void ebt_unregister_table(struct ebt_table *table) ...@@ -1213,8 +1207,7 @@ void ebt_unregister_table(struct ebt_table *table)
down(&ebt_mutex); down(&ebt_mutex);
LIST_DELETE(&ebt_tables, table); LIST_DELETE(&ebt_tables, table);
up(&ebt_mutex); up(&ebt_mutex);
if (table->private->entries) vfree(table->private->entries);
vfree(table->private->entries);
if (table->private->chainstack) { if (table->private->chainstack) {
for (i = 0; i < num_possible_cpus(); i++) for (i = 0; i < num_possible_cpus(); i++)
vfree(table->private->chainstack[i]); vfree(table->private->chainstack[i]);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment