mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-24 14:45:24 +00:00
Give virNWFilterVarCombIterNext saner semantics
The virNWFilterVarCombIterNext method will free its parameter when it gets to the end of the iterator. This is somewhat misleading design, making it appear as if the caller has a memory leak. Remove the free'ing of the parameter and ensure that the calling method ebiptablesCreateRuleInstanceIterate free's it instead. Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
This commit is contained in:
parent
9f7da130f4
commit
ef2c4c965b
@ -526,10 +526,8 @@ next:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ci->nIter == i) {
|
if (ci->nIter == i)
|
||||||
virNWFilterVarCombIterFree(ci);
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
|
||||||
|
|
||||||
return ci;
|
return ci;
|
||||||
}
|
}
|
||||||
|
@ -2772,13 +2772,13 @@ ebiptablesCreateRuleInstanceIterate(
|
|||||||
virNWFilterRuleInstPtr res)
|
virNWFilterRuleInstPtr res)
|
||||||
{
|
{
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
virNWFilterVarCombIterPtr vciter;
|
virNWFilterVarCombIterPtr vciter, tmp;
|
||||||
|
|
||||||
/* rule->vars holds all the variables names that this rule will access.
|
/* rule->vars holds all the variables names that this rule will access.
|
||||||
* iterate over all combinations of the variables' values and instantiate
|
* iterate over all combinations of the variables' values and instantiate
|
||||||
* the filtering rule with each combination.
|
* the filtering rule with each combination.
|
||||||
*/
|
*/
|
||||||
vciter = virNWFilterVarCombIterCreate(vars,
|
tmp = vciter = virNWFilterVarCombIterCreate(vars,
|
||||||
rule->varAccess, rule->nVarAccess);
|
rule->varAccess, rule->nVarAccess);
|
||||||
if (!vciter)
|
if (!vciter)
|
||||||
return -1;
|
return -1;
|
||||||
@ -2788,12 +2788,12 @@ ebiptablesCreateRuleInstanceIterate(
|
|||||||
nwfilter,
|
nwfilter,
|
||||||
rule,
|
rule,
|
||||||
ifname,
|
ifname,
|
||||||
vciter,
|
tmp,
|
||||||
res);
|
res);
|
||||||
if (rc < 0)
|
if (rc < 0)
|
||||||
break;
|
break;
|
||||||
vciter = virNWFilterVarCombIterNext(vciter);
|
tmp = virNWFilterVarCombIterNext(tmp);
|
||||||
} while (vciter != NULL);
|
} while (tmp != NULL);
|
||||||
|
|
||||||
virNWFilterVarCombIterFree(vciter);
|
virNWFilterVarCombIterFree(vciter);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user