comparison src/normal.c @ 18045:af0b4ffab794 v8.1.2018

patch 8.1.2018: using freed memory when out of memory and displaying message Commit: https://github.com/vim/vim/commit/e5fbd7393067c279860598ac8359d1617b1082b9 Author: Bram Moolenaar <Bram@vim.org> Date: Mon Sep 9 20:04:13 2019 +0200 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.
author Bram Moolenaar <Bram@vim.org>
date Mon, 09 Sep 2019 20:15:03 +0200
parents 2ea47dee7ddd
children 90b0af9ba4ff
comparison
equal deleted inserted replaced
18044:062623edb7c8 18045:af0b4ffab794
1180 { 1180 {
1181 char_u *kmsg; 1181 char_u *kmsg;
1182 1182
1183 kmsg = keep_msg; 1183 kmsg = keep_msg;
1184 keep_msg = NULL; 1184 keep_msg = NULL;
1185 /* showmode() will clear keep_msg, but we want to use it anyway */ 1185 // showmode() will clear keep_msg, but we want to use it anyway
1186 update_screen(0); 1186 update_screen(0);
1187 /* now reset it, otherwise it's put in the history again */ 1187 // now reset it, otherwise it's put in the history again
1188 keep_msg = kmsg; 1188 keep_msg = kmsg;
1189 msg_attr((char *)kmsg, keep_msg_attr); 1189
1190 vim_free(kmsg); 1190 kmsg = vim_strsave(keep_msg);
1191 if (kmsg != NULL)
1192 {
1193 msg_attr((char *)kmsg, keep_msg_attr);
1194 vim_free(kmsg);
1195 }
1191 } 1196 }
1192 setcursor(); 1197 setcursor();
1193 cursor_on(); 1198 cursor_on();
1194 out_flush(); 1199 out_flush();
1195 if (msg_scroll || emsg_on_display) 1200 if (msg_scroll || emsg_on_display)