|Subject:||[fluid-dev] Small memory leak in tcp shell server.|
|Date:||Tue, 10 Oct 2017 23:55:01 +0200 (CEST)|
There is a small memory leak in tcp command shell server in v 1.1.6 and may be still present in v1.1.7 ?.
The memory leak is a lack of deletion of the command handler (fluid_cmd_handler_t).
The command handler is created at client connection time, just before client creation task (in fluid_cmd.c-fluid_server_handle_connection()) here:
fluid_server_handle_connection(fluid_server_t* server, fluid_socket_t client_socket, char* addr)
handler = server->newclient(server->data, addr);
However, this command handler seems never deleted (delete_fluid_cmd_handler()) (imho).
In this case this handler should be deleted on the following events:
- (1) When the remote client quit, or when the server force client closing (i.e at client task destruction time).
- (2) On error when calling 'client creation task' function.
So, the fusing fix could be to call delete_fluid_cmd_handler() only one time (i.e when the client task is deleted) ((in fluid_cmd.c-delete_fluid_client()), here:
void delete_fluid_client(fluid_client_t* client)
This is a fresh proposition and haven't not yet tested.
|[Prev in Thread]||Current Thread||[Next in Thread]|