]> git.ipfire.org Git - thirdparty/libvirt.git/commit
nwfilter: Don't have virNWFilterIPAddrMapAddIPAddr consume input
authorJohn Ferlan <jferlan@redhat.com>
Fri, 29 Sep 2017 19:55:29 +0000 (15:55 -0400)
committerJohn Ferlan <jferlan@redhat.com>
Mon, 2 Oct 2017 10:14:32 +0000 (06:14 -0400)
commita55eaced607c9253f8422e2a207ef12039f99558
tree542338f817211c84ff388310c4e5b7c1e4e1dd67
parent039702174c56e28c51f0bd1268b9a843c1fa0ddc
nwfilter: Don't have virNWFilterIPAddrMapAddIPAddr consume input

On pure success paths, virNWFilterIPAddrMapAddIPAddr was validly
consuming the input @addr; however, on failure paths it was possible
that virNWFilterVarValueCreateSimple succeed, but virNWFilterHashTablePut
failed resulting in virNWFilterVarValueFree being called to clean
up @val which also cleaned up the input @addr. Thus the caller had
no way to determine on failure whether it too should clean up the
passed parameter.

Instead, let's create a copy of the input @addr, then handle that
properly in the API allowing/forcing the caller to free it's own
copy of the input parameter.
src/conf/nwfilter_ipaddrmap.c
src/nwfilter/nwfilter_dhcpsnoop.c