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>
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,