diff options
author | Bram Moolenaar <Bram@vim.org> | 2021-03-26 22:15:26 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2021-03-26 22:15:26 +0100 |
commit | bb5d87c8504588be9c9d2fecc5b6455a2b2f6201 (patch) | |
tree | 42a47e83ef85f073de6f70c9e8ea3476da25286d | |
parent | ccc25aa285498d572a735bba5afd22aec9f605f4 (diff) | |
download | vim-git-bb5d87c8504588be9c9d2fecc5b6455a2b2f6201.tar.gz |
patch 8.2.2661: leaking memory when looping over a stringv8.2.2661
Problem: Leaking memory when looping over a string.
Solution: Free the memory.
-rw-r--r-- | src/eval.c | 4 | ||||
-rw-r--r-- | src/version.c | 2 |
2 files changed, 5 insertions, 1 deletions
diff --git a/src/eval.c b/src/eval.c index b4593baba..6522f0f24 100644 --- a/src/eval.c +++ b/src/eval.c @@ -1815,8 +1815,10 @@ next_for_item(void *fi_void, char_u *arg) tv.v_lock = VAR_FIXED; tv.vval.v_string = vim_strnsave(fi->fi_string + fi->fi_byte_idx, len); fi->fi_byte_idx += len; - return ex_let_vars(arg, &tv, TRUE, fi->fi_semicolon, + result = ex_let_vars(arg, &tv, TRUE, fi->fi_semicolon, fi->fi_varcount, flag, NULL) == OK; + vim_free(tv.vval.v_string); + return result; } item = fi->fi_lw.lw_item; diff --git a/src/version.c b/src/version.c index f172437af..5596bbb27 100644 --- a/src/version.c +++ b/src/version.c @@ -751,6 +751,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 2661, +/**/ 2660, /**/ 2659, |