summaryrefslogtreecommitdiff
path: root/src/lib/ecore
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 /src/lib/ecore
parent132c047c4d8b84cc879568ee3f2f8acfd403bd58 (diff)
ecore_exe - handle realloc failures by complaining and rolling back
@fix
Diffstat (limited to 'src/lib/ecore')
-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,
668 { 668 {
669 if (count >= max) 669 if (count >= max)
670 { 670 {
671 Ecore_Exe_Event_Data_Line *lines;
672
671 /* In testing, the lines seem to arrive in batches of 500 to 1000 lines at most, roughly speaking. */ 673 /* In testing, the lines seem to arrive in batches of 500 to 1000 lines at most, roughly speaking. */
672 max += 10; /* FIXME: Maybe keep track of the largest number of lines ever sent, and add half that many instead of 10. */ 674 max += 10; /* FIXME: Maybe keep track of the largest number of lines ever sent, and add half that many instead of 10. */
673 e->lines = realloc(e->lines, sizeof(Ecore_Exe_Event_Data_Line) * (max + 1)); /* Allow room for the NULL termination. */ 675 lines = realloc(e->lines, sizeof(Ecore_Exe_Event_Data_Line) * (max + 1)); /* Allow room for the NULL termination. */
676 if (!lines)
677 {
678 ERR("Out of memory adding exe data lines to event");
679 break;
680 }
681 e->lines = lines;
674 } 682 }
675 /* raster said to leave the line endings as line endings, however - 683 /* raster said to leave the line endings as line endings, however -
676 * This is line buffered mode, we are not dealing with binary here, but lines. 684 * 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,
1149 inbuf_num += num; 1157 inbuf_num += num;
1150 } 1158 }
1151 else // realloc fails and returns NULL. 1159 else // realloc fails and returns NULL.
1152 inbuf = temp; 1160 {
1161 ERR("Out of memory in exe generic data handler");
1162 inbuf = temp;
1163 }
1153 } 1164 }
1154 else 1165 else
1155 { /* No more data to read. */ 1166 { /* No more data to read. */