Skip to content

Commit

Permalink
Merge "[HICN-668] Fix various leaks across codebase"
Browse files Browse the repository at this point in the history
  • Loading branch information
msardara authored and Gerrit Code Review committed Jan 19, 2021
2 parents 4f7939f + 3e88e40 commit aa7b78d
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 7 deletions.
22 changes: 15 additions & 7 deletions hicn-light/src/hicn/config/configuration.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
8 changes: 8 additions & 0 deletions hicn-light/src/hicn/core/forwarder.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit aa7b78d

Please sign in to comment.