summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>2017-07-24 14:10:17 +0900
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2017-07-24 14:10:17 +0900
commitb47cbdcb65b2cc9d4ec3456a922842d26b5b5564 (patch)
treecdfef6120487857cd2996a6c54e95ebe99608165
parent132c047c4d8b84cc879568ee3f2f8acfd403bd58 (diff)
downloadefl-b47cbdcb65b2cc9d4ec3456a922842d26b5b5564.tar.gz
ecore_exe - handle realloc failures by complaining and rolling back
@fix
-rw-r--r--src/lib/ecore/ecore_exe_posix.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/lib/ecore/ecore_exe_posix.c b/src/lib/ecore/ecore_exe_posix.c
index f30ff7a8f5..9624f80be4 100644
--- a/src/lib/ecore/ecore_exe_posix.c
+++ b/src/lib/ecore/ecore_exe_posix.c
@@ -668,9 +668,17 @@ _impl_ecore_exe_event_data_get(Ecore_Exe *obj,
{
if (count >= max)
{
+ Ecore_Exe_Event_Data_Line *lines;
+
/* In testing, the lines seem to arrive in batches of 500 to 1000 lines at most, roughly speaking. */
max += 10; /* FIXME: Maybe keep track of the largest number of lines ever sent, and add half that many instead of 10. */
- e->lines = realloc(e->lines, sizeof(Ecore_Exe_Event_Data_Line) * (max + 1)); /* Allow room for the NULL termination. */
+ lines = realloc(e->lines, sizeof(Ecore_Exe_Event_Data_Line) * (max + 1)); /* Allow room for the NULL termination. */
+ if (!lines)
+ {
+ ERR("Out of memory adding exe data lines to event");
+ break;
+ }
+ e->lines = lines;
}
/* raster said to leave the line endings as line endings, however -
* This is line buffered mode, we are not dealing with binary here, but lines.
@@ -1149,7 +1157,10 @@ _ecore_exe_data_generic_handler(void *data,
inbuf_num += num;
}
else // realloc fails and returns NULL.
- inbuf = temp;
+ {
+ ERR("Out of memory in exe generic data handler");
+ inbuf = temp;
+ }
}
else
{ /* No more data to read. */