forked from enlightenment/efl
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.hebbar@samsung.com> Reviewers: cedric Reviewed By: cedric Subscribers: cedric Differential Revision: https://phab.enlightenment.org/D3151 Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
This commit is contained in:
parent
01e42f86ab
commit
54b47a78eb
|
@ -53,13 +53,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;
|
||||
|
|
Loading…
Reference in New Issue