session: fix use-after-free
Make sure to reinitialize data before free-ing it.
Type: fix
Change-Id: I45727c456d0345204d4825ecdd9690c5ebeb5e94
Signed-off-by: Benoît Ganne <bganne@cisco.com>
diff --git a/src/vnet/udp/udp.c b/src/vnet/udp/udp.c
index 949c635..fbd9e98 100644
--- a/src/vnet/udp/udp.c
+++ b/src/vnet/udp/udp.c
@@ -58,9 +58,10 @@
void
udp_connection_free (udp_connection_t * uc)
{
- pool_put (udp_main.connections[uc->c_thread_index], uc);
+ u32 thread_index = uc->c_thread_index;
if (CLIB_DEBUG)
clib_memset (uc, 0xFA, sizeof (*uc));
+ pool_put (udp_main.connections[thread_index], uc);
}
void