[libvirt PATCH v2 09/15] nwfilter: clear nrules when resetting virNWFilterInst

Laine Stump posted 15 patches 4 years, 4 months ago
[libvirt PATCH v2 09/15] nwfilter: clear nrules when resetting virNWFilterInst
Posted by Laine Stump 4 years, 4 months ago
It's possible/probable the callers to virNWFilterInstReset() make it
unnecessary to set the object's nrules to 0 after freeing all its
rules, but that same function is setting nfilters to 0, so let's do
the same for the sake of consistency.

Signed-off-by: Laine Stump <laine@redhat.com>
---
 src/nwfilter/nwfilter_gentech_driver.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/nwfilter/nwfilter_gentech_driver.c b/src/nwfilter/nwfilter_gentech_driver.c
index b7633eb10a..aff42cbfb0 100644
--- a/src/nwfilter/nwfilter_gentech_driver.c
+++ b/src/nwfilter/nwfilter_gentech_driver.c
@@ -240,6 +240,7 @@ virNWFilterInstReset(virNWFilterInstPtr inst)
     for (i = 0; i < inst->nrules; i++)
         virNWFilterRuleInstFree(inst->rules[i]);
     VIR_FREE(inst->rules);
+    inst->nrules = 0;
 }
 
 
-- 
2.25.4

Re: [libvirt PATCH v2 09/15] nwfilter: clear nrules when resetting virNWFilterInst
Posted by Ján Tomko 4 years, 4 months ago
On a Tuesday in 2020, Laine Stump wrote:
>It's possible/probable the callers to virNWFilterInstReset() make it
>unnecessary to set the object's nrules to 0 after freeing all its
>rules, but that same function is setting nfilters to 0, so let's do
>the same for the sake of consistency.
>
>Signed-off-by: Laine Stump <laine@redhat.com>
>---
> src/nwfilter/nwfilter_gentech_driver.c | 1 +
> 1 file changed, 1 insertion(+)
>

Reviewed-by: Ján Tomko <jtomko@redhat.com>

Jano