cedric pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=c79d822f53985821b245e134b568f4017668a462
commit c79d822f53985821b245e134b568f4017668a462 Author: Srivardhan Hebbar <sri.heb...@samsung.com> Date: Wed Sep 23 12:42:18 2015 -0700 ecore_con: preventing possible NULL pointer dereference. Summary: Checking if client is NULL before freeing is not of much use. If it is NULL, it would have crashed before when it was dereferenced in printf. So checking NULL before dereferencing. Signed-off-by: Srivardhan Hebbar <sri.heb...@samsung.com> Reviewers: cedric Subscribers: cedric Differential Revision: https://phab.enlightenment.org/D3088 Signed-off-by: Cedric BAIL <ced...@osg.samsung.com> --- src/examples/ecore/ecore_con_server_http_example.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/examples/ecore/ecore_con_server_http_example.c b/src/examples/ecore/ecore_con_server_http_example.c index 1269b73..b0dfc63 100644 --- a/src/examples/ecore/ecore_con_server_http_example.c +++ b/src/examples/ecore/ecore_con_server_http_example.c @@ -58,13 +58,14 @@ _del(void *data EINA_UNUSED, int type EINA_UNUSED, Ecore_Con_Event_Client_Del *e client = ecore_con_client_data_get(ev->client); printf("Lost client with ip %s!\n", ecore_con_client_ip_get(ev->client)); - printf("Total data received from this client: %d\n", client->sdata); + if (client) + { + printf("Total data received from this client: %d\n", client->sdata); + free(client); + } printf("Client was connected for %0.3f seconds.\n", ecore_con_client_uptime_get(ev->client)); - if (client) - free(client); - ecore_con_client_del(ev->client); return ECORE_CALLBACK_RENEW; --