]> git.ipfire.org Git - thirdparty/iproute2.git/commit
bridge: Fix memory leak when doing 'fdb get'
authorBenjamin Poirier <bpoirier@nvidia.com>
Sun, 10 Jul 2022 23:52:51 +0000 (08:52 +0900)
committerStephen Hemminger <stephen@networkplumber.org>
Mon, 18 Jul 2022 16:46:24 +0000 (09:46 -0700)
commit6db01afd60748afbba114be2773be338c5be28ff
tree79aacd29306e02f6ca403964a75a026ae8188337
parent1d540336b026ed5bfe10eefac383db7f434d842f
bridge: Fix memory leak when doing 'fdb get'

With the following command sequence:

ip link add br0 up type bridge
ip link add dummy0 up address 02:00:00:00:00:01 master br0 type dummy
bridge fdb get 02:00:00:00:00:01 br br0

when running the last command under valgrind, it reports

32,768 bytes in 1 blocks are definitely lost in loss record 2 of 2
   at 0x483F7B5: malloc (vg_replace_malloc.c:381)
   by 0x11C1EC: rtnl_recvmsg (libnetlink.c:838)
   by 0x11C4D1: __rtnl_talk_iov.constprop.0 (libnetlink.c:1040)
   by 0x11D994: __rtnl_talk (libnetlink.c:1141)
   by 0x11D994: rtnl_talk (libnetlink.c:1147)
   by 0x10D336: fdb_get (fdb.c:652)
   by 0x48907FC: (below main) (libc-start.c:332)

Free the answer obtained from rtnl_talk().

Fixes: 4ed5ad7bd3c6 ("bridge: fdb get support")
Reported-by: Ido Schimmel <idosch@nvidia.com>
Reviewed-by: Ido Schimmel <idosch@nvidia.com>
Signed-off-by: Benjamin Poirier <bpoirier@nvidia.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
bridge/fdb.c