summaryrefslogtreecommitdiffstats
path: root/xtables.c
diff options
context:
space:
mode:
authorJan Engelhardt <jengelh@medozas.de>2011-01-31 02:33:43 +0100
committerJan Engelhardt <jengelh@medozas.de>2011-01-31 02:36:51 +0100
commitdf288236cd254798be3759fef4cbc3e535f5a1c3 (patch)
tree15a7470494bb0c1f37f40f49018786ab65521728 /xtables.c
parent298d70e8564f03c844435123bf36e84419c2f65a (diff)
xtables: set custom opts to NULL on free
When inside ip6tables-restore, xtables_free_opts can be called multiple times, especially when trying to exit with an error message from outside do_command. So set it to NULL so that we do not attempt to free a dangling pointer. Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
Diffstat (limited to 'xtables.c')
-rw-r--r--xtables.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/xtables.c b/xtables.c
index 00362992..be103d75 100644
--- a/xtables.c
+++ b/xtables.c
@@ -75,8 +75,10 @@ void basic_exit_err(enum xtables_exittype status, const char *msg, ...)
void xtables_free_opts(int unused)
{
- if (xt_params->opts != xt_params->orig_opts)
+ if (xt_params->opts != xt_params->orig_opts) {
free(xt_params->opts);
+ xt_params->opts = NULL;
+ }
}
struct option *xtables_merge_options(struct option *orig_opts,