mirror of
https://github.com/vim/vim.git
synced 2025-07-26 11:04:33 -04:00
patch 8.1.2372: VMS: failing realloc leaks memory
Problem: VMS: failing realloc leaks memory. (Chakshu Gupta) Solution: Free the memory. (partly fixes #5292)
This commit is contained in:
parent
05ad5ff0ab
commit
9625d3d92d
12
src/os_vms.c
12
src/os_vms.c
@ -404,12 +404,17 @@ vms_wproc(char *name, int val)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
if (--vms_match_free == 0) {
|
if (--vms_match_free == 0) {
|
||||||
|
char_u **old_vms_fmatch = vms_fmatch;
|
||||||
|
|
||||||
/* add more space to store matches */
|
/* add more space to store matches */
|
||||||
vms_match_alloced += EXPL_ALLOC_INC;
|
vms_match_alloced += EXPL_ALLOC_INC;
|
||||||
vms_fmatch = vim_realloc(vms_fmatch,
|
vms_fmatch = vim_realloc(old_vms_fmatch,
|
||||||
sizeof(char **) * vms_match_alloced);
|
sizeof(char **) * vms_match_alloced);
|
||||||
if (!vms_fmatch)
|
if (!vms_fmatch)
|
||||||
|
{
|
||||||
|
vim_free(old_vms_fmatch);
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
vms_match_free = EXPL_ALLOC_INC;
|
vms_match_free = EXPL_ALLOC_INC;
|
||||||
}
|
}
|
||||||
vms_fmatch[vms_match_num] = vim_strsave((char_u *)name);
|
vms_fmatch[vms_match_num] = vim_strsave((char_u *)name);
|
||||||
@ -489,10 +494,13 @@ mch_expand_wildcards(int num_pat, char_u **pat, int *num_file, char_u ***file, i
|
|||||||
/* allocate memory for pointers */
|
/* allocate memory for pointers */
|
||||||
if (--files_free < 1)
|
if (--files_free < 1)
|
||||||
{
|
{
|
||||||
|
char_u **old_file = *file;
|
||||||
|
|
||||||
files_alloced += EXPL_ALLOC_INC;
|
files_alloced += EXPL_ALLOC_INC;
|
||||||
*file = vim_realloc(*file, sizeof(char_u **) * files_alloced);
|
*file = vim_realloc(old_file, sizeof(char_u **) * files_alloced);
|
||||||
if (*file == NULL)
|
if (*file == NULL)
|
||||||
{
|
{
|
||||||
|
vim_free(old_file);
|
||||||
*file = (char_u **)"";
|
*file = (char_u **)"";
|
||||||
*num_file = 0;
|
*num_file = 0;
|
||||||
return(FAIL);
|
return(FAIL);
|
||||||
|
@ -742,6 +742,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 */
|
||||||
|
/**/
|
||||||
|
2372,
|
||||||
/**/
|
/**/
|
||||||
2371,
|
2371,
|
||||||
/**/
|
/**/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user