[libvirt] [PATCH] nwfilter: Fix possible segfault on sometimes consumed variable

Erik Skultety eskultet at redhat.com
Thu Sep 28 10:13:36 UTC 2017


On Wed, Sep 27, 2017 at 10:22:17AM -0400, John Ferlan wrote:
> The virNWFilterIPAddrMapAddIPAddr code can consume the @addr parameter
> on success when the @ifname is found in the ipAddressMap->hashTable
> hash table in the call to virNWFilterVarValueAddValue; however, if
> not found in the hash table, then @addr is formatted into a @val
> which is stored in the table and on return the caller would be
> expected to free @addr.
>
> Thus, the caller has no way to determine on success whether @addr was
> consumed, so in order to fix this create a @tmp variable which will
> be stored/consumed when virNWFilterVarValueAddValue succeeds. That way
> the caller can free @addr whether the function returns success or failure.
>
> Signed-off-by: John Ferlan <jferlan at redhat.com>

Reviewed-by: Erik Skultety <eskultet at redhat.com>




More information about the libvir-list mailing list