patch 8.1.0148: memory leak when using :tcl expr command
Problem: Memory leak when using :tcl expr command.
Solution: Free the result of expression evaluation. (Dominique Pelle,
closes #3150)
diff --git a/src/if_tcl.c b/src/if_tcl.c
index 690c639..9ecabf8 100644
--- a/src/if_tcl.c
+++ b/src/if_tcl.c
@@ -1385,7 +1385,10 @@
if (str == NULL)
Tcl_SetResult(interp, _("invalid expression"), TCL_STATIC);
else
+ {
Tcl_SetResult(interp, str, TCL_VOLATILE);
+ vim_free(str);
+ }
err = vimerror(interp);
#else
Tcl_SetResult(interp, _("expressions disabled at compile time"), TCL_STATIC);