diff src/misc1.c @ 17801:6582dda76821 v8.1.1897

patch 8.1.1897: may free memory twice when out of memory commit https://github.com/vim/vim/commit/f1552d07d715b437d941659479942c2543b02bd4 Author: Bram Moolenaar <Bram@vim.org> Date: Wed Aug 21 12:54:18 2019 +0200 patch 8.1.1897: may free memory twice when out of memory Problem: May free memory twice when out of memory. Solution: Check that backslash_halve_save() returns a different pointer. (Dominique Pelle, closes #4847)
author Bram Moolenaar <Bram@vim.org>
date Wed, 21 Aug 2019 13:00:03 +0200
parents 0f7ae8010787
children 46f95606b9ec
line wrap: on
line diff
--- a/src/misc1.c
+++ b/src/misc1.c
@@ -4086,7 +4086,9 @@ gen_expand_wildcards(
 		addfile(&ga, t, flags | EW_DIR | EW_FILE);
 	    else
 		addfile(&ga, t, flags);
-	    vim_free(t);
+
+	    if (t != p)
+		vim_free(t);
 	}
 
 #if defined(FEAT_SEARCHPATH)