forked from enlightenment/efl
ecore exe - fix fix malloc fail handling
for both ecore_exe_win32.c and ecore_exe_posix.c when the rare case (basically almost never) that malloc fails for the exe read/err buffers also set the data size to 0 so it doesn't lie with a NULL ptr for data. @fix
This commit is contained in:
parent
0f08ee686e
commit
dc137aba43
|
@ -711,20 +711,24 @@ _impl_ecore_exe_event_data_get(Ecore_Exe *obj,
|
||||||
exe->read_data_size = i - last;
|
exe->read_data_size = i - last;
|
||||||
exe->read_data_buf = malloc(exe->read_data_size);
|
exe->read_data_buf = malloc(exe->read_data_size);
|
||||||
if (exe->read_data_buf)
|
if (exe->read_data_buf)
|
||||||
{
|
|
||||||
memcpy(exe->read_data_buf, c, exe->read_data_size);
|
memcpy(exe->read_data_buf, c, exe->read_data_size);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
exe->read_data_size = 0;
|
||||||
|
ERR("Out of memory in allocating exe pipe data");
|
||||||
}
|
}
|
||||||
else ERR("Out of memory in allocating exe pipe data");
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
exe->error_data_size = i - last;
|
exe->error_data_size = i - last;
|
||||||
exe->error_data_buf = malloc(exe->error_data_size);
|
exe->error_data_buf = malloc(exe->error_data_size);
|
||||||
if (exe->error_data_buf)
|
if (exe->error_data_buf)
|
||||||
{
|
|
||||||
memcpy(exe->error_data_buf, c, exe->error_data_size);
|
memcpy(exe->error_data_buf, c, exe->error_data_size);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
exe->error_data_size = 0;
|
||||||
|
ERR("Out of memory in allocating exe pipe data");
|
||||||
}
|
}
|
||||||
else ERR("Out of memory in allocating exe pipe data");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (count == 0) /* No lines to send, cancel the event. */
|
if (count == 0) /* No lines to send, cancel the event. */
|
||||||
|
|
|
@ -664,23 +664,27 @@ _impl_ecore_exe_event_data_get(Ecore_Exe *obj,
|
||||||
if (count != 0) e->size = last;
|
if (count != 0) e->size = last;
|
||||||
if (flags & ECORE_EXE_PIPE_READ)
|
if (flags & ECORE_EXE_PIPE_READ)
|
||||||
{
|
{
|
||||||
|
exe->pipe_read.data_size = i - last;
|
||||||
exe->pipe_read.data_buf = malloc(exe->pipe_read.data_size);
|
exe->pipe_read.data_buf = malloc(exe->pipe_read.data_size);
|
||||||
if (exe->pipe_read.data_buf)
|
if (exe->pipe_read.data_buf)
|
||||||
{
|
|
||||||
exe->pipe_read.data_size = i - last;
|
|
||||||
memcpy(exe->pipe_read.data_buf, c, exe->pipe_read.data_size);
|
memcpy(exe->pipe_read.data_buf, c, exe->pipe_read.data_size);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
exe->pipe_read.data_size = 0;
|
||||||
|
ERR("Out of memory in allocating exe pipe data");
|
||||||
}
|
}
|
||||||
else ERR("Out of memory in allocating exe pipe data");
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
exe->pipe_error.data_size = i - last;
|
||||||
exe->pipe_error.data_buf = malloc(exe->pipe_error.data_size);
|
exe->pipe_error.data_buf = malloc(exe->pipe_error.data_size);
|
||||||
if (exe->pipe_error.data_buf)
|
if (exe->pipe_error.data_buf)
|
||||||
{
|
|
||||||
exe->pipe_error.data_size = i - last;
|
|
||||||
memcpy(exe->pipe_error.data_buf, c, exe->pipe_error.data_size);
|
memcpy(exe->pipe_error.data_buf, c, exe->pipe_error.data_size);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
exe->pipe_error.data_size = 0;
|
||||||
|
ERR("Out of memory in allocating exe pipe data");
|
||||||
}
|
}
|
||||||
else ERR("Out of memory in allocating exe pipe data");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (count == 0) /* No lines to send, cancel the event. */
|
if (count == 0) /* No lines to send, cancel the event. */
|
||||||
|
|
Loading…
Reference in New Issue