forked from enlightenment/efl
Right fix for alloc
Actually we already checked that num != 0, but lacked num < 0 for one of the allocs SVN revision: 54205
This commit is contained in:
parent
e289280418
commit
5fc5dcc215
|
@ -1781,10 +1781,7 @@ _ecore_con_cl_read(Ecore_Con_Server *svr)
|
||||||
if (lost_server)
|
if (lost_server)
|
||||||
_ecore_con_server_kill(svr);
|
_ecore_con_server_kill(svr);
|
||||||
|
|
||||||
if ((!num) || svr->delete_me)
|
if ((num > 0) && (!svr->delete_me))
|
||||||
return;
|
|
||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
Ecore_Con_Event_Server_Data *e;
|
Ecore_Con_Event_Server_Data *e;
|
||||||
|
|
||||||
|
@ -1793,18 +1790,14 @@ _ecore_con_cl_read(Ecore_Con_Server *svr)
|
||||||
|
|
||||||
svr->event_count++;
|
svr->event_count++;
|
||||||
e->server = svr;
|
e->server = svr;
|
||||||
e->data = NULL;
|
e->data = malloc(num);
|
||||||
if (num > 0)
|
if (!e->data)
|
||||||
{
|
{
|
||||||
e->data = malloc(num);
|
ERR("alloc!");
|
||||||
if (!e->data)
|
free(e);
|
||||||
{
|
return;
|
||||||
ERR("alloc!");
|
|
||||||
free(e);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
memcpy(e->data, buf, num);
|
|
||||||
}
|
}
|
||||||
|
memcpy(e->data, buf, num);
|
||||||
e->size = num;
|
e->size = num;
|
||||||
ecore_event_add(ECORE_CON_EVENT_SERVER_DATA, e,
|
ecore_event_add(ECORE_CON_EVENT_SERVER_DATA, e,
|
||||||
_ecore_con_event_server_data_free, NULL);
|
_ecore_con_event_server_data_free, NULL);
|
||||||
|
@ -2130,18 +2123,14 @@ _ecore_con_svr_cl_read(Ecore_Con_Client *cl)
|
||||||
cl->event_count++;
|
cl->event_count++;
|
||||||
_ecore_con_cl_timer_update(cl);
|
_ecore_con_cl_timer_update(cl);
|
||||||
e->client = cl;
|
e->client = cl;
|
||||||
e->data = NULL;
|
e->data = malloc(num);
|
||||||
if (num > 0)
|
if (!e->data)
|
||||||
{
|
{
|
||||||
e->data = malloc(num);
|
ERR("alloc!");
|
||||||
if (!e->data)
|
free(e);
|
||||||
{
|
return;
|
||||||
ERR("alloc!");
|
|
||||||
free(e);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
memcpy(e->data, buf, num);
|
|
||||||
}
|
}
|
||||||
|
memcpy(e->data, buf, num);
|
||||||
e->size = num;
|
e->size = num;
|
||||||
ecore_event_add(ECORE_CON_EVENT_CLIENT_DATA, e,
|
ecore_event_add(ECORE_CON_EVENT_CLIENT_DATA, e,
|
||||||
_ecore_con_event_client_data_free, NULL);
|
_ecore_con_event_client_data_free, NULL);
|
||||||
|
|
Loading…
Reference in New Issue