Skip to content

Commit 0f1c670

Browse files
committed
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)
1 parent 2e47cab commit 0f1c670

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

src/getchar.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1296,11 +1296,11 @@ free_typebuf(void)
12961296
if (typebuf.tb_buf == typebuf_init)
12971297
internal_error("Free typebuf 1");
12981298
else
1299-
vim_free(typebuf.tb_buf);
1299+
VIM_CLEAR(typebuf.tb_buf);
13001300
if (typebuf.tb_noremap == noremapbuf_init)
13011301
internal_error("Free typebuf 2");
13021302
else
1303-
vim_free(typebuf.tb_noremap);
1303+
VIM_CLEAR(typebuf.tb_noremap);
13041304
}
13051305

13061306
/*

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -757,6 +757,8 @@ static char *(features[]) =
757757

758758
static int included_patches[] =
759759
{ /* Add new patch number below this line */
760+
/**/
761+
2091,
760762
/**/
761763
2090,
762764
/**/

0 commit comments

Comments
 (0)