patch 8.2.2661: leaking memory when looping over a string
Problem: Leaking memory when looping over a string.
Solution: Free the memory.
diff --git a/src/eval.c b/src/eval.c
index b4593ba..6522f0f 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -1815,8 +1815,10 @@
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;