diff options
author | Carsten Haitzler (Rasterman) <raster@rasterman.com> | 2017-07-24 16:59:53 +0900 |
---|---|---|
committer | Carsten Haitzler (Rasterman) <raster@rasterman.com> | 2017-07-24 16:59:53 +0900 |
commit | fe6dc2000d432f5bc9cdaf42bcd67e0dd6ba6393 (patch) | |
tree | 9f06d355381b9418ef5f70f26fc18cfdbfa1c033 | |
parent | 829d0bc3f993a0346171844486f1d021465c4055 (diff) | |
download | efl-fe6dc2000d432f5bc9cdaf42bcd67e0dd6ba6393.tar.gz |
ecore exe - pisix - handle malloc fails
handle malloc fails better
@fix
-rw-r--r-- | src/lib/ecore/ecore_exe_posix.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/lib/ecore/ecore_exe_posix.c b/src/lib/ecore/ecore_exe_posix.c index 9624f80be4..4f5d125944 100644 --- a/src/lib/ecore/ecore_exe_posix.c +++ b/src/lib/ecore/ecore_exe_posix.c @@ -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. */ |