From 3e88e40270de4a272b17ccea4db35722a30d98a3 Mon Sep 17 00:00:00 2001 From: Jordan Augé Date: Tue, 19 Jan 2021 17:32:41 +0100 Subject: [HICN-668] Fix various leaks across codebase MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I0d2e9846ebb9f784220de78d6103295c19d73409 Signed-off-by: Jordan Augé --- hicn-light/src/hicn/config/configuration.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) (limited to 'hicn-light/src/hicn/config/configuration.c') diff --git a/hicn-light/src/hicn/config/configuration.c b/hicn-light/src/hicn/config/configuration.c index 39d327165..c4321299e 100644 --- a/hicn-light/src/hicn/config/configuration.c +++ b/hicn-light/src/hicn/config/configuration.c @@ -1490,20 +1490,28 @@ void configuration_ReceiveCommand(Configuration *config, command_id command, configuration_DispatchCommand(config, command, request, ingressId); configuration_SendResponse(config, response, ingressId); + /* + * For list commands: + * - deallocate request + * - deallocate response _payload_ + * + * For other commands, generating a ACK/NACK packet: + * - deallocate request + * - deallocate response, as the ACK/Nack is allocated + */ + parcMemory_Deallocate(&request); + switch (command) { case LIST_CONNECTIONS: case LIST_ROUTES: // case LIST_INTERFACES: case ETC...: case LIST_LISTENERS: - parcMemory_Deallocate( - &response[1] - .iov_base); // deallocate payload only if generated at fwd side + case LIST_POLICIES: + /* Deallocate payload */ + parcMemory_Deallocate(&response[1] .iov_base); break; default: + parcMemory_Deallocate(&response); break; } - // deallocate received request. It coincides with response[0].iov_base memory - // parcMemory_Deallocate(&request); //deallocate header and payload (if - // same sent by controller) - parcMemory_Deallocate(&response); // deallocate iovec pointer } -- cgit 1.2.3-korg