aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean Dewar <seandewar@users.noreply.github.com>2022-01-01 07:51:13 +0000
committerSean Dewar <seandewar@users.noreply.github.com>2022-02-05 19:55:16 +0000
commit83a48d7a44c69a8b159bdcf90029005f2f4a8de5 (patch)
tree4938f4550471e9ce65d67d87838aeae813fc0775
parent7002a3433bed7600ec02d64927ae0e77d077f34e (diff)
downloadrneovim-83a48d7a44c69a8b159bdcf90029005f2f4a8de5.tar.gz
rneovim-83a48d7a44c69a8b159bdcf90029005f2f4a8de5.tar.bz2
rneovim-83a48d7a44c69a8b159bdcf90029005f2f4a8de5.zip
vim-patch:8.2.2661: leaking memory when looping over a string
Problem: Leaking memory when looping over a string. Solution: Free the memory. https://github.com/vim/vim/commit/bb5d87c8504588be9c9d2fecc5b6455a2b2f6201
-rw-r--r--src/nvim/eval.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/nvim/eval.c b/src/nvim/eval.c
index aecb23f251..b4baeb5240 100644
--- a/src/nvim/eval.c
+++ b/src/nvim/eval.c
@@ -2698,7 +2698,10 @@ bool 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, fi->fi_varcount, false, NULL) == OK;
+ const int result
+ = ex_let_vars(arg, &tv, true, fi->fi_semicolon, fi->fi_varcount, false, NULL) == OK;
+ xfree(tv.vval.v_string);
+ return result;
}
listitem_T *item = fi->fi_lw.lw_item;