summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2019-11-30 22:57:53 +0100
committerBram Moolenaar <Bram@vim.org>2019-11-30 22:57:53 +0100
commit9625d3d92d93be52f5d89a57b27ba2400e0fc6d2 (patch)
tree7bb547de32b4be9d7564190ca74e8d321f594ab0 /src
parent05ad5ff0ab34ed9a5296dedd420ca81698b8ce22 (diff)
downloadvim-git-9625d3d92d93be52f5d89a57b27ba2400e0fc6d2.tar.gz
patch 8.1.2372: VMS: failing realloc leaks memoryv8.1.2372
Problem: VMS: failing realloc leaks memory. (Chakshu Gupta) Solution: Free the memory. (partly fixes #5292)
Diffstat (limited to 'src')
-rw-r--r--src/os_vms.c12
-rw-r--r--src/version.c2
2 files changed, 12 insertions, 2 deletions
diff --git a/src/os_vms.c b/src/os_vms.c
index 769377673..8845b28a9 100644
--- a/src/os_vms.c
+++ b/src/os_vms.c
@@ -404,12 +404,17 @@ vms_wproc(char *name, int val)
return 1;
}
if (--vms_match_free == 0) {
+ char_u **old_vms_fmatch = vms_fmatch;
+
/* add more space to store matches */
vms_match_alloced += EXPL_ALLOC_INC;
- vms_fmatch = vim_realloc(vms_fmatch,
+ vms_fmatch = vim_realloc(old_vms_fmatch,
sizeof(char **) * vms_match_alloced);
if (!vms_fmatch)
+ {
+ vim_free(old_vms_fmatch);
return 0;
+ }
vms_match_free = EXPL_ALLOC_INC;
}
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 */
if (--files_free < 1)
{
+ char_u **old_file = *file;
+
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)
{
+ vim_free(old_file);
*file = (char_u **)"";
*num_file = 0;
return(FAIL);
diff --git a/src/version.c b/src/version.c
index 281fafc7d..790607575 100644
--- a/src/version.c
+++ b/src/version.c
@@ -743,6 +743,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 2372,
+/**/
2371,
/**/
2370,