ecore: update buffer size before allocation, not after.

This commit is contained in:
Cedric BAIL 2017-09-14 11:35:35 -07:00
parent 44c0199f42
commit a10a1fa641
1 changed files with 2 additions and 2 deletions

View File

@ -708,20 +708,20 @@ _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);
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);
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");