changeset 18947:d6c7b2f9aa20 v8.2.0034

patch 8.2.0034: missing check for out of memory Commit: https://github.com/vim/vim/commit/70188f5b23ea7efec7adaf74e0af797d1bb1afe8 Author: Bram Moolenaar <Bram@vim.org> Date: Mon Dec 23 18:18:52 2019 +0100 patch 8.2.0034: missing check for out of memory Problem: Missing check for out of memory. Solution: Check for NULL after vim_strsave(). (Dominique Pelle, closes #5393)
author Bram Moolenaar <Bram@vim.org>
date Mon, 23 Dec 2019 18:30:04 +0100
parents 59c8d375c1ec
children bb405ee57349
files src/filepath.c src/version.c
diffstat 2 files changed, 7 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/filepath.c
+++ b/src/filepath.c
@@ -1658,7 +1658,8 @@ f_resolve(typval_T *argvars, typval_T *r
 	int	limit = 100;
 
 	p = vim_strsave(p);
-
+	if (p == NULL)
+	    goto fail;
 	if (p[0] == '.' && (vim_ispathsep(p[1])
 				   || (p[1] == '.' && (vim_ispathsep(p[2])))))
 	    is_relative_to_current = TRUE;
@@ -1681,7 +1682,10 @@ f_resolve(typval_T *argvars, typval_T *r
 
 	buf = alloc(MAXPATHL + 1);
 	if (buf == NULL)
+	{
+	    vim_free(p);
 	    goto fail;
+	}
 
 	for (;;)
 	{
--- 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 */
 /**/
+    34,
+/**/
     33,
 /**/
     32,