From 74947203afedd0227ee383ce4396745b2d5f6c4f Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Sat, 28 Sep 2019 14:45:35 -0400 Subject: 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) https://github.com/vim/vim/commit/0f1c6708fdf17bb9c7305b8af5d12189956195b6 --- src/nvim/getchar.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/nvim/getchar.c b/src/nvim/getchar.c index 2469bb5baa..af642a8e11 100644 --- a/src/nvim/getchar.c +++ b/src/nvim/getchar.c @@ -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); } } -- cgit