summaryrefslogtreecommitdiff
path: root/src/popupmnu.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/popupmnu.c')
-rw-r--r--src/popupmnu.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/popupmnu.c b/src/popupmnu.c
index ba9c7adc7..2639d97d5 100644
--- a/src/popupmnu.c
+++ b/src/popupmnu.c
@@ -1102,12 +1102,19 @@ split_message(char_u *mesg, pumitem_T **array)
else
thislen = item->bytelen;
- /* put indent at the start */
+ // put indent at the start
p = alloc(thislen + item->indent * 2 + 1);
+ if (p == NULL)
+ {
+ for (line = 0; line <= height - 1; ++line)
+ vim_free((*array)[line].pum_text);
+ vim_free(*array);
+ goto failed;
+ }
for (ind = 0; ind < item->indent * 2; ++ind)
p[ind] = ' ';
- /* exclude spaces at the end of the string */
+ // exclude spaces at the end of the string
for (copylen = thislen; copylen > 0; --copylen)
if (item->start[skip + copylen - 1] != ' ')
break;