]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
Wed Mar 30 17:17:15 IST 2007 Mark McLoughlin <markmc@redhat.com>
authorMark McLoughlin <markmc@redhat.com>
Fri, 30 Mar 2007 16:20:19 +0000 (16:20 +0000)
committerMark McLoughlin <markmc@redhat.com>
Fri, 30 Mar 2007 16:20:19 +0000 (16:20 +0000)
        * qemud/iptables.c: ensure iptablesContext is zereod out
        when allocating so we don't try and free an invalid pointer.

ChangeLog
qemud/iptables.c

index 5d3a6278e3f542cdbf3161238cbe635496cc4ac4..ffeffa9883dbd59e6ccf8d106bed985e98aed2b7 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Wed Mar 30 17:17:15 IST 2007 Mark McLoughlin <markmc@redhat.com>
+
+       * 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  <rjones@redhat.com>
 
        * python/generator.py: Python bindings now throw exceptions
index 10b3e73b9bb488b1597a8a16a1b72b13f424ff1f..ced742753d5bd9758653b4e1aaefde5e3c1db4cf 100644 (file)
@@ -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);
 }