ecore exe - pisix - handle malloc fails

handle malloc fails better
@fix
This commit is contained in:
Carsten Haitzler 2017-07-24 16:59:53 +09:00
parent 829d0bc3f9
commit fe6dc2000d
1 changed files with 12 additions and 4 deletions

View File

@ -707,15 +707,23 @@ _impl_ecore_exe_event_data_get(Ecore_Exe *obj,
if (count != 0) e->size = last;
if (flags & ECORE_EXE_PIPE_READ)
{
exe->read_data_size = i - last;
exe->read_data_buf = malloc(exe->read_data_size);
memcpy(exe->read_data_buf, c, exe->read_data_size);
if (exe->read_data_buf)
{
exe->read_data_size = i - last;
memcpy(exe->read_data_buf, c, exe->read_data_size);
}
else ERR("Out of memory in allocating exe pipe data");
}
else
{
exe->error_data_size = i - last;
exe->error_data_buf = malloc(exe->error_data_size);
memcpy(exe->error_data_buf, c, exe->error_data_size);
if (exe->error_data_buf)
{
exe->error_data_size = i - last;
memcpy(exe->error_data_buf, c, exe->error_data_size);
}
else ERR("Out of memory in allocating exe pipe data");
}
}
if (count == 0) /* No lines to send, cancel the event. */