# HG changeset patch # User Bram Moolenaar # Date 1593458103 -7200 # Node ID 42e2fb7ec6e1c45527d1ef3fcee9291cedb498b2 # Parent 80ed45189526adb4ebfbbe91477f9b2ede661c0b patch 8.2.1087: possible memory leak when file expansion fails Commit: https://github.com/vim/vim/commit/566cc8c72bb8036f015a435800f28ef9f6a9a3b6 Author: Bram Moolenaar Date: Mon Jun 29 21:14:51 2020 +0200 patch 8.2.1087: possible memory leak when file expansion fails Problem: Possible memory leak when file expansion fails. Solution: Clear the grow array when returning FAIL. Use an error message instead of an empty string. diff --git a/src/filepath.c b/src/filepath.c --- a/src/filepath.c +++ b/src/filepath.c @@ -3813,8 +3813,13 @@ gen_expand_wildcards( vim_free(p); } + // When returning FAIL the array must be freed here. + if (retval == FAIL) + ga_clear(&ga); + *num_file = ga.ga_len; - *file = (ga.ga_data != NULL) ? (char_u **)ga.ga_data : (char_u **)""; + *file = (ga.ga_data != NULL) ? (char_u **)ga.ga_data + : (char_u **)_("no matches"); recursive = FALSE; diff --git a/src/version.c b/src/version.c --- a/src/version.c +++ b/src/version.c @@ -755,6 +755,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 1087, +/**/ 1086, /**/ 1085,