[...]
This assumes that virNWFilterIPAddrMapAddIPAddr consumes inetaddr only
if it returns zero. However in a fraction of the unlikely cases when
this function call can fail (all of them on OOM), it can consume it even
though it returns -1 -- if virNWFilterVarValueCreateSimple succeeds,
but virNWFilterHashTablePut fails.
If virNWFilterHashTablePut fails in virNWFilterIPAddrMapAddIPAddr, then
it calls virNWFilterVarValueFree which will VIR_FREE the value that was
stored in @val which is returned from virNWFilterVarValueCreateSimple.
I still hate the nwfilter code.
John
> }
>
> ret = virNWFilterInstantiateFilterLate(req->driver,
> @@ -637,7 +639,8 @@ learnIPAddressThread(void *arg)
> req->filterparams);
> VIR_DEBUG("Result from applying firewall rules on "
> "%s with IP addr %s : %d", req->ifname,
> inetaddr, ret);
[...]