On 04/08/2014 11:38 AM, Daniel P. Berrange wrote:
Create a nwfilterxml2firewalltest to exercise the
ebiptables_driver.applyNewRules method with a variety of
different XML input files. The XML input files are taken
from the libvirt-tck nwfilter tests. While the nwfilter
tests verify the final state of the iptables chains, this
test verifies the set of commands invoked to create the
chains.
Signed-off-by: Daniel P. Berrange <berrange(a)redhat.com>
You are reusing the TCK tests. With TCK tests passing, the created
commands must be correct.
+
+static void
+virNWFilterInstReset(virNWFilterInstPtr inst)
+{
+ size_t i;
+
+ for (i = 0; i < inst->nfilters; i++)
+ virNWFilterDefFree(inst->filters[i]);
+ VIR_FREE(inst->filters);
+ inst->nfilters = 0;
+
+ for (i = 0; i < inst->nrules; i++)
+ virNWFilterRuleInstFree(inst->rules[i]);
+ inst->nrules = 0;
+ VIR_FREE(inst->rules);
+}
The VIR_FREE(inst->rules) could be placed before the inst->nrules = 0 to
match the pattern above :-)
Not even a memory leak...
ACK