From 3b1d7dbd297cba50cbd54be118e549f879b2fc6a Mon Sep 17 00:00:00 2001 From: Jacques Samain Date: Wed, 20 Jan 2021 09:32:11 +0100 Subject: [HICN-668] Fix leaks + double free Signed-off-by: Jacques Samain Change-Id: Ic52adacaeee737120f08e4fece93eff44fa29f87 --- hicn-light/src/hicn/core/messageHandler.h | 2 +- hicn-light/src/hicn/io/streamConnection.c | 2 +- hicn-light/src/hicn/io/udpListener.c | 5 ++++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/hicn-light/src/hicn/core/messageHandler.h b/hicn-light/src/hicn/core/messageHandler.h index a8b2a3e54..f6b3e4e36 100644 --- a/hicn-light/src/hicn/core/messageHandler.h +++ b/hicn-light/src/hicn/core/messageHandler.h @@ -321,7 +321,7 @@ static inline bool messageHandler_handleHooks(Forwarder * forwarder, /* ... */ /* END Process */ - + parcMemory_Deallocate((void **)&packet); return true; } diff --git a/hicn-light/src/hicn/io/streamConnection.c b/hicn-light/src/hicn/io/streamConnection.c index 00298d1b0..53ffa74c3 100644 --- a/hicn-light/src/hicn/io/streamConnection.c +++ b/hicn-light/src/hicn/io/streamConnection.c @@ -610,7 +610,7 @@ static void _conn_readcb(PARCEventQueue *event, PARCEventType type, // If received correctly the whole message, send to dispatcher if (message) { forwarder_ReceiveCommand(stream->forwarder, command, rx, stream->id); - parcMemory_Deallocate((void **)&rx); + //parcMemory_Deallocate((void **)&rx); parcEventBuffer_Destroy(&message); } diff --git a/hicn-light/src/hicn/io/udpListener.c b/hicn-light/src/hicn/io/udpListener.c index 16e8c8ddf..3b318c500 100644 --- a/hicn-light/src/hicn/io/udpListener.c +++ b/hicn-light/src/hicn/io/udpListener.c @@ -481,6 +481,7 @@ static void _handleWldrNotification(UdpListener *udp, unsigned connId, const Connection *conn = connectionTable_FindById( forwarder_GetConnectionTable(udp->forwarder), connId); if (conn == NULL) { + parcMemory_Deallocate((void **)&msgBuffer); return; } @@ -556,6 +557,7 @@ static void _readCommand(ListenerOps * listener, int fd, if (*command != REQUEST_LIGHT){ printf("the message received is not a command, drop\n"); + parcMemory_Deallocate((void **) &command); return; } @@ -563,6 +565,7 @@ static void _readCommand(ListenerOps * listener, int fd, if (id >= LAST_COMMAND_VALUE){ printf("the message received is not a valid command, drop\n"); + parcMemory_Deallocate((void **) &command); return; } @@ -588,7 +591,7 @@ static void _readCommand(ListenerOps * listener, int fd, forwarder_ReceiveCommand(udp->forwarder, id, request, connid); parcMemory_Deallocate((void **) &command); - parcMemory_Deallocate((void **) &request); + //parcMemory_Deallocate((void **) &request); } -- cgit 1.2.3-korg