The match or the target might be reused in the next invocation
of iptables and then xtables operates on this invalid pointer.
xt_t->t and xt_m->m are keept alive via the global variables
xtables_targets and xtables_matches.
{
g_strfreev(ctx->argv);
g_free(ctx->ip);
- if (ctx->xt_t != NULL)
+ if (ctx->xt_t != NULL) {
g_free(ctx->xt_t->t);
- if (ctx->xt_m != NULL)
+ ctx->xt_t->t = NULL;
+ }
+ if (ctx->xt_m != NULL) {
g_free(ctx->xt_m->m);
+ ctx->xt_m->m = NULL;
+ }
g_free(ctx);
}