1
0
forked from aniani/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 #4991)
This commit is contained in:
Bram Moolenaar
2019-09-28 15:24:00 +02:00
parent 2e47cab715
commit 0f1c6708fd
2 changed files with 4 additions and 2 deletions

View File

@@ -1296,11 +1296,11 @@ free_typebuf(void)
if (typebuf.tb_buf == typebuf_init) if (typebuf.tb_buf == typebuf_init)
internal_error("Free typebuf 1"); internal_error("Free typebuf 1");
else else
vim_free(typebuf.tb_buf); VIM_CLEAR(typebuf.tb_buf);
if (typebuf.tb_noremap == noremapbuf_init) if (typebuf.tb_noremap == noremapbuf_init)
internal_error("Free typebuf 2"); internal_error("Free typebuf 2");
else else
vim_free(typebuf.tb_noremap); VIM_CLEAR(typebuf.tb_noremap);
} }
/* /*

View File

@@ -757,6 +757,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
2091,
/**/ /**/
2090, 2090,
/**/ /**/