HomeFreeBSD

if_vxlan(4): Plug a memory leak

Description

if_vxlan(4): Plug a memory leak

On clone creating, either failure from vxlan_set_user_config() or
ifc_copyin() will result in leaking previous allocated counters.

Since counter_u64_alloc(M_WAITOK) never fails, make vxlan_stats_alloc()
void and move the allocation for counters below checking ifd->params to
avoid memory leak.

Reviewed by: kp, glebius
Fixes: b092fd6c973d if_vxlan(4): add support for hardware assisted checksumming, TSO, and RSS
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D45822

(cherry picked from commit 087f5e08ab5f0384163f76f73b9a91c98a3ba450)
(cherry picked from commit e729e750806d3873d5de24cce3b47cc054145985)