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:
13
src/normal.c
13
src/normal.c
@@ -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();
|
||||
|
Reference in New Issue
Block a user