diff options
author | James Lamanna <jlamanna@gmail.com> | 2005-06-23 01:12:57 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2005-06-23 01:12:57 -0400 |
commit | 68d318720052154bc6b2513b0f15d0d947cc53c9 (patch) | |
tree | c6b566a3a946cae0543cf9bd1fbc77fe9d5efd7d /net | |
parent | 285b3afefacff14bc98e5754b8b48a0a2b42f0df (diff) |
[EBTABLES]: vfree() checking cleanups
From: jlamanna@gmail.com
ebtables.c vfree() checking cleanups.
Signed-off by: James Lamanna <jlamanna@gmail.com>
Signed-off-by: Domen Puncer <domen@coderock.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r-- | net/bridge/netfilter/ebtables.c | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/net/bridge/netfilter/ebtables.c b/net/bridge/netfilter/ebtables.c index 18ebc664769b..c4540144f0f4 100644 --- a/net/bridge/netfilter/ebtables.c +++ b/net/bridge/netfilter/ebtables.c | |||
@@ -859,8 +859,7 @@ static int translate_table(struct ebt_replace *repl, | |||
859 | if (repl->valid_hooks & (1 << i)) | 859 | if (repl->valid_hooks & (1 << i)) |
860 | if (check_chainloops(newinfo->hook_entry[i], | 860 | if (check_chainloops(newinfo->hook_entry[i], |
861 | cl_s, udc_cnt, i, newinfo->entries)) { | 861 | cl_s, udc_cnt, i, newinfo->entries)) { |
862 | if (cl_s) | 862 | vfree(cl_s); |
863 | vfree(cl_s); | ||
864 | return -EINVAL; | 863 | return -EINVAL; |
865 | } | 864 | } |
866 | 865 | ||
@@ -883,8 +882,7 @@ static int translate_table(struct ebt_replace *repl, | |||
883 | EBT_ENTRY_ITERATE(newinfo->entries, newinfo->entries_size, | 882 | EBT_ENTRY_ITERATE(newinfo->entries, newinfo->entries_size, |
884 | ebt_cleanup_entry, &i); | 883 | ebt_cleanup_entry, &i); |
885 | } | 884 | } |
886 | if (cl_s) | 885 | vfree(cl_s); |
887 | vfree(cl_s); | ||
888 | return ret; | 886 | return ret; |
889 | } | 887 | } |
890 | 888 | ||
@@ -1030,8 +1028,7 @@ static int do_replace(void __user *user, unsigned int len) | |||
1030 | } | 1028 | } |
1031 | vfree(table); | 1029 | vfree(table); |
1032 | 1030 | ||
1033 | if (counterstmp) | 1031 | vfree(counterstmp); |
1034 | vfree(counterstmp); | ||
1035 | return ret; | 1032 | return ret; |
1036 | 1033 | ||
1037 | free_unlock: | 1034 | free_unlock: |
@@ -1040,8 +1037,7 @@ free_iterate: | |||
1040 | EBT_ENTRY_ITERATE(newinfo->entries, newinfo->entries_size, | 1037 | EBT_ENTRY_ITERATE(newinfo->entries, newinfo->entries_size, |
1041 | ebt_cleanup_entry, NULL); | 1038 | ebt_cleanup_entry, NULL); |
1042 | free_counterstmp: | 1039 | free_counterstmp: |
1043 | if (counterstmp) | 1040 | vfree(counterstmp); |
1044 | vfree(counterstmp); | ||
1045 | /* can be initialized in translate_table() */ | 1041 | /* can be initialized in translate_table() */ |
1046 | if (newinfo->chainstack) { | 1042 | if (newinfo->chainstack) { |
1047 | for (i = 0; i < num_possible_cpus(); i++) | 1043 | for (i = 0; i < num_possible_cpus(); i++) |
@@ -1049,11 +1045,9 @@ free_counterstmp: | |||
1049 | vfree(newinfo->chainstack); | 1045 | vfree(newinfo->chainstack); |
1050 | } | 1046 | } |
1051 | free_entries: | 1047 | free_entries: |
1052 | if (newinfo->entries) | 1048 | vfree(newinfo->entries); |
1053 | vfree(newinfo->entries); | ||
1054 | free_newinfo: | 1049 | free_newinfo: |
1055 | if (newinfo) | 1050 | vfree(newinfo); |
1056 | vfree(newinfo); | ||
1057 | return ret; | 1051 | return ret; |
1058 | } | 1052 | } |
1059 | 1053 | ||
@@ -1213,8 +1207,7 @@ void ebt_unregister_table(struct ebt_table *table) | |||
1213 | down(&ebt_mutex); | 1207 | down(&ebt_mutex); |
1214 | LIST_DELETE(&ebt_tables, table); | 1208 | LIST_DELETE(&ebt_tables, table); |
1215 | up(&ebt_mutex); | 1209 | up(&ebt_mutex); |
1216 | if (table->private->entries) | 1210 | vfree(table->private->entries); |
1217 | vfree(table->private->entries); | ||
1218 | if (table->private->chainstack) { | 1211 | if (table->private->chainstack) { |
1219 | for (i = 0; i < num_possible_cpus(); i++) | 1212 | for (i = 0; i < num_possible_cpus(); i++) |
1220 | vfree(table->private->chainstack[i]); | 1213 | vfree(table->private->chainstack[i]); |