diff options
author | Jan Edmund Lazo <jan.lazo@mail.utoronto.ca> | 2019-09-28 14:45:35 -0400 |
---|---|---|
committer | Jan Edmund Lazo <jan.lazo@mail.utoronto.ca> | 2019-10-01 22:27:44 -0400 |
commit | 74947203afedd0227ee383ce4396745b2d5f6c4f (patch) | |
tree | 4d85890507382e60f79442044f90e35b270df5f9 /src/nvim/getchar.c | |
parent | 56c860ac4a8897cdce8c7e6a9d238f0775de1979 (diff) | |
download | rneovim-74947203afedd0227ee383ce4396745b2d5f6c4f.tar.gz rneovim-74947203afedd0227ee383ce4396745b2d5f6c4f.tar.bz2 rneovim-74947203afedd0227ee383ce4396745b2d5f6c4f.zip |
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
Diffstat (limited to 'src/nvim/getchar.c')
-rw-r--r-- | src/nvim/getchar.c | 4 |
1 files changed, 2 insertions, 2 deletions
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); } } |