ecore: update buffer size before allocation, not after.
This commit is contained in:
parent
44c0199f42
commit
a10a1fa641
|
@ -708,20 +708,20 @@ _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->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)
|
||||||
{
|
{
|
||||||
exe->read_data_size = i - last;
|
|
||||||
memcpy(exe->read_data_buf, c, exe->read_data_size);
|
memcpy(exe->read_data_buf, c, exe->read_data_size);
|
||||||
}
|
}
|
||||||
else 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_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)
|
||||||
{
|
{
|
||||||
exe->error_data_size = i - last;
|
|
||||||
memcpy(exe->error_data_buf, c, exe->error_data_size);
|
memcpy(exe->error_data_buf, c, exe->error_data_size);
|
||||||
}
|
}
|
||||||
else ERR("Out of memory in allocating exe pipe data");
|
else ERR("Out of memory in allocating exe pipe data");
|
||||||
|
|
Loading…
Reference in New Issue