0
0
mirror of https://github.com/vim/vim.git synced 2025-09-24 03:44:06 -04:00

patch 8.1.2018: using freed memory when out of memory and displaying message

Problem:    Using freed memory when out of memory and displaying message.
Solution:   Make a copy of the message first.
This commit is contained in:
Bram Moolenaar
2019-09-09 20:04:13 +02:00
parent 96e38a86a7
commit e5fbd73930
4 changed files with 23 additions and 18 deletions

View File

@@ -1182,12 +1182,17 @@ getcount:
kmsg = keep_msg;
keep_msg = NULL;
/* showmode() will clear keep_msg, but we want to use it anyway */
// showmode() will clear keep_msg, but we want to use it anyway
update_screen(0);
/* now reset it, otherwise it's put in the history again */
// now reset it, otherwise it's put in the history again
keep_msg = kmsg;
msg_attr((char *)kmsg, keep_msg_attr);
vim_free(kmsg);
kmsg = vim_strsave(keep_msg);
if (kmsg != NULL)
{
msg_attr((char *)kmsg, keep_msg_attr);
vim_free(kmsg);
}
}
setcursor();
cursor_on();