diff options
author | Mauro Sardara <msardara@cisco.com> | 2021-01-19 17:25:49 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@fd.io> | 2021-01-19 17:25:49 +0000 |
commit | aa7b78dfca61e4af67e660d0904f9cbe3e98f5dc (patch) | |
tree | 06562a3bdf2fc828be07884527ea88d8bc8d11f2 /hicn-light/src | |
parent | 4f7939f8031e00d6808f5ebe3ad92c4109f1e414 (diff) | |
parent | 3e88e40270de4a272b17ccea4db35722a30d98a3 (diff) |
Merge "[HICN-668] Fix various leaks across codebase"
Diffstat (limited to 'hicn-light/src')
-rw-r--r-- | hicn-light/src/hicn/config/configuration.c | 22 | ||||
-rw-r--r-- | hicn-light/src/hicn/core/forwarder.c | 8 |
2 files changed, 23 insertions, 7 deletions
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 } diff --git a/hicn-light/src/hicn/core/forwarder.c b/hicn-light/src/hicn/core/forwarder.c index f7b0af2c2..94e8cc885 100644 --- a/hicn-light/src/hicn/core/forwarder.c +++ b/hicn-light/src/hicn/core/forwarder.c @@ -412,6 +412,14 @@ void forwarder_Receive(Forwarder *forwarder, Message *message) { forwarder->connectionTable, message_GetIngressConnectionId(message)); if (!conn) { + /* + * Drop is a static method in messageProcessor which might or might not need + * to be called for accounting purposes. This call was initially absent so + * the behaviour was kept like this, as this situation is unlikely. We need + * to release memory though, as this is not done in Drop anyways. + */ + //messageProcessor_Drop(forwarder->processor, message); + message_Release(&message); return; } |