Looking at bsd implementation, we can see that there are some potential mem leaks in linux implementation. Fix them. Signed-off-by: David Marchand <david.marchand@6wind.com> Acked-by: Anatoly Burakov <anatoly.burakov@intel.com> Acked-by: Neil Horman <nhorman@tuxdriver.com>