diff options
author | Daniel Wagner <daniel.wagner@bmw-carit.de> | 2013-02-21 17:42:30 +0100 |
---|---|---|
committer | Patrik Flykt <patrik.flykt@linux.intel.com> | 2013-02-22 12:42:52 +0200 |
commit | 4f30adc930c73036c6d1a146cdb21933af38e0d4 (patch) | |
tree | 3128f2b2aa03e7841d15c91ed6d32dd2831ca8da | |
parent | bdd1663c5cf56853ca745635f7448e09613d5e36 (diff) | |
download | connman-4f30adc930c73036c6d1a146cdb21933af38e0d4.tar.gz connman-4f30adc930c73036c6d1a146cdb21933af38e0d4.tar.bz2 connman-4f30adc930c73036c6d1a146cdb21933af38e0d4.zip |
iptables: Reset pointer after freeing
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.
-rw-r--r-- | src/iptables.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/iptables.c b/src/iptables.c index 4d46a5b9..44c5c73c 100644 --- a/src/iptables.c +++ b/src/iptables.c @@ -2048,10 +2048,14 @@ static void cleanup_parse_context(struct parse_context *ctx) { 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); } |