提交 ef2c4c96 编写于 作者: D Daniel P. Berrange

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: NDaniel P. Berrange <berrange@redhat.com>
上级 9f7da130
......@@ -526,10 +526,8 @@ next:
}
}
if (ci->nIter == i) {
virNWFilterVarCombIterFree(ci);
if (ci->nIter == i)
return NULL;
}
return ci;
}
......
......@@ -2772,14 +2772,14 @@ ebiptablesCreateRuleInstanceIterate(
virNWFilterRuleInstPtr res)
{
int rc = 0;
virNWFilterVarCombIterPtr vciter;
virNWFilterVarCombIterPtr vciter, tmp;
/* rule->vars holds all the variables names that this rule will access.
* iterate over all combinations of the variables' values and instantiate
* the filtering rule with each combination.
*/
vciter = virNWFilterVarCombIterCreate(vars,
rule->varAccess, rule->nVarAccess);
tmp = vciter = virNWFilterVarCombIterCreate(vars,
rule->varAccess, rule->nVarAccess);
if (!vciter)
return -1;
......@@ -2788,12 +2788,12 @@ ebiptablesCreateRuleInstanceIterate(
nwfilter,
rule,
ifname,
vciter,
tmp,
res);
if (rc < 0)
break;
vciter = virNWFilterVarCombIterNext(vciter);
} while (vciter != NULL);
tmp = virNWFilterVarCombIterNext(tmp);
} while (tmp != NULL);
virNWFilterVarCombIterFree(vciter);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册