raster pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=fe6dc2000d432f5bc9cdaf42bcd67e0dd6ba6393

commit fe6dc2000d432f5bc9cdaf42bcd67e0dd6ba6393
Author: Carsten Haitzler (Rasterman) <ras...@rasterman.com>
Date:   Mon Jul 24 16:59:53 2017 +0900

    ecore exe - pisix - handle malloc fails
    
    handle malloc fails better
    @fix
---
 src/lib/ecore/ecore_exe_posix.c | 16 ++++++++++++----
 1 file 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. */

-- 


Reply via email to