From: Mark McLoughlin Date: Fri, 30 Mar 2007 16:20:19 +0000 (+0000) Subject: Wed Mar 30 17:17:15 IST 2007 Mark McLoughlin X-Git-Tag: LIBVIRT_0_2_2~23 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=27c1d7b9fa3ff2b3efa30e7a4c2cfbf09289988b;p=thirdparty%2Flibvirt.git Wed Mar 30 17:17:15 IST 2007 Mark McLoughlin * qemud/iptables.c: ensure iptablesContext is zereod out when allocating so we don't try and free an invalid pointer. --- diff --git a/ChangeLog b/ChangeLog index 5d3a6278e3..ffeffa9883 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Wed Mar 30 17:17:15 IST 2007 Mark McLoughlin + + * qemud/iptables.c: ensure iptablesContext is zereod out + when allocating so we don't try and free an invalid pointer. + Wed Mar 28 12:23:00 BST 2007 Richard W.M. Jones * python/generator.py: Python bindings now throw exceptions diff --git a/qemud/iptables.c b/qemud/iptables.c index 10b3e73b9b..ced742753d 100644 --- a/qemud/iptables.c +++ b/qemud/iptables.c @@ -490,7 +490,7 @@ iptablesContextNew(void) { iptablesContext *ctx; - if (!(ctx = (iptablesContext *) malloc(sizeof (iptablesContext)))) + if (!(ctx = (iptablesContext *) calloc(1, sizeof (iptablesContext)))) return NULL; if (!(ctx->input_filter = iptRulesNew("filter", IPTABLES_PREFIX "INPUT"))) @@ -512,9 +512,12 @@ iptablesContextNew(void) void iptablesContextFree(iptablesContext *ctx) { - iptRulesFree(ctx->input_filter); - iptRulesFree(ctx->forward_filter); - iptRulesFree(ctx->nat_postrouting); + if (ctx->input_filter) + iptRulesFree(ctx->input_filter); + if (ctx->forward_filter) + iptRulesFree(ctx->forward_filter); + if (ctx->nat_postrouting) + iptRulesFree(ctx->nat_postrouting); free(ctx); }