Mercurial > vim
changeset 18193:f31b0ac6e175 v8.1.2091
patch 8.1.2091: double free when memory allocation fails
Commit: https://github.com/vim/vim/commit/0f1c6708fdf17bb9c7305b8af5d12189956195b6
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Sep 28 15:24:00 2019 +0200
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 https://github.com/vim/vim/issues/4991)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 28 Sep 2019 15:30:03 +0200 |
parents | f881dda47df2 |
children | 52a1ffca4253 |
files | src/getchar.c src/version.c |
diffstat | 2 files changed, 4 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/src/getchar.c +++ b/src/getchar.c @@ -1296,11 +1296,11 @@ free_typebuf(void) if (typebuf.tb_buf == typebuf_init) internal_error("Free typebuf 1"); else - vim_free(typebuf.tb_buf); + VIM_CLEAR(typebuf.tb_buf); if (typebuf.tb_noremap == noremapbuf_init) internal_error("Free typebuf 2"); else - vim_free(typebuf.tb_noremap); + VIM_CLEAR(typebuf.tb_noremap); } /*