[RTEMS 5 PATCH 3/3] libmisc/shell/edit: Return if no memory in move_gap
chrisj at rtems.org
chrisj at rtems.org
Mon Jan 30 03:15:11 UTC 2023
From: Chris Johns <chrisj at rtems.org>
Closes #4565
---
cpukit/libmisc/shell/main_edit.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/cpukit/libmisc/shell/main_edit.c b/cpukit/libmisc/shell/main_edit.c
index 586f33bd93..681e8c5f3c 100644
--- a/cpukit/libmisc/shell/main_edit.c
+++ b/cpukit/libmisc/shell/main_edit.c
@@ -407,6 +407,9 @@ static void move_gap(struct editor *ed, int pos, int minsize) {
if (gapsize + MINEXTEND > minsize) minsize = gapsize + MINEXTEND;
newsize = (ed->end - ed->start) - gapsize + minsize;
start = (unsigned char *) malloc(newsize); // TODO check for out of memory
+ if (start == NULL) {
+ return;
+ }
gap = start + pos;
rest = gap + minsize;
end = start + newsize;
--
2.37.1
More information about the devel
mailing list