diff options
author | Chris Johns <chrisj@rtems.org> | 2023-01-30 14:11:59 +1100 |
---|---|---|
committer | Chris Johns <chrisj@rtems.org> | 2023-01-31 07:16:14 +1100 |
commit | edea93c40bd621d215d1ece07b9e43f255e8b420 (patch) | |
tree | 96f0a222acd86af4bd9255a81a494989b34da875 | |
parent | libmisc/shell/edit: Fix closing the editor (diff) | |
download | rtems-edea93c40bd621d215d1ece07b9e43f255e8b420.tar.bz2 |
libmisc/shell/edit: Return if no memory in move_gap
Closes #4835
-rw-r--r-- | cpukit/libmisc/shell/main_edit.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/cpukit/libmisc/shell/main_edit.c b/cpukit/libmisc/shell/main_edit.c index b9e377bc23..6e954639e2 100644 --- a/cpukit/libmisc/shell/main_edit.c +++ b/cpukit/libmisc/shell/main_edit.c @@ -412,6 +412,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; |