[libvirt] [PATCH 26/26] Add a test suite for nwfilter ebiptables tech driver

Stefan Berger stefanb at linux.vnet.ibm.com
Wed Apr 16 20:16:28 UTC 2014


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 at 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




More information about the libvir-list mailing list