patch 8.0.1079: memory leak when remote_foreground() fails
Problem: Memory leak when remote_foreground() fails.
Solution: Free the error message.
diff --git a/src/evalfunc.c b/src/evalfunc.c
index a2542e2..ea342b4 100644
--- a/src/evalfunc.c
+++ b/src/evalfunc.c
@@ -8638,7 +8638,10 @@
# endif
{
if (r != NULL)
+ {
EMSG(r); /* sending worked but evaluation failed */
+ vim_free(r);
+ }
else
EMSG2(_("E241: Unable to send to %s"), server_name);
return;
@@ -8698,6 +8701,8 @@
argvars[1].v_type = VAR_STRING;
argvars[1].vval.v_string = vim_strsave((char_u *)"foreground()");
argvars[2].v_type = VAR_UNKNOWN;
+ rettv->v_type = VAR_STRING;
+ rettv->vval.v_string = NULL;
remote_common(argvars, rettv, TRUE);
vim_free(argvars[1].vval.v_string);
# endif