Hi,

 

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)
{

...

fluid_cmd_handler_t* handler;

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)
{
  delete_fluid_cmd_handler(client->handler);

  ...

  ...

}

 

This is a fresh proposition and haven't not yet tested.

Regards.

 

jjc

 
_______________________________________________
fluid-dev mailing list
fluid-dev@nongnu.org
https://lists.nongnu.org/mailman/listinfo/fluid-dev

Reply via email to