vim-patch:8.1.2091: double free when memory allocation fails

Problem:    Double free when memory allocation fails. (Zu-Ming Jiang)
Solution:   Use VIM_CLEAR() instead of vim_free(). (closes vim/vim#4991)
0f1c6708fd
This commit is contained in:
Jan Edmund Lazo
2019-09-28 14:45:35 -04:00
parent 56c860ac4a
commit 74947203af

View File

@@ -1165,12 +1165,12 @@ void free_typebuf(void)
if (typebuf.tb_buf == typebuf_init) {
internal_error("Free typebuf 1");
} else {
xfree(typebuf.tb_buf);
XFREE_CLEAR(typebuf.tb_buf);
}
if (typebuf.tb_noremap == noremapbuf_init) {
internal_error("Free typebuf 2");
} else {
xfree(typebuf.tb_noremap);
XFREE_CLEAR(typebuf.tb_noremap);
}
}