0
0
mirror of https://github.com/vim/vim.git synced 2025-07-26 11:04:33 -04:00

patch 8.0.1079: memory leak when remote_foreground() fails

Problem:    Memory leak when remote_foreground() fails.
Solution:   Free the error message.
This commit is contained in:
Bram Moolenaar 2017-09-09 16:25:54 +02:00
parent b4ea1914b8
commit 09d6c3818d
3 changed files with 8 additions and 0 deletions

View File

@ -8638,7 +8638,10 @@ remote_common(typval_T *argvars, typval_T *rettv, int expr)
# endif # endif
{ {
if (r != NULL) if (r != NULL)
{
EMSG(r); /* sending worked but evaluation failed */ EMSG(r); /* sending worked but evaluation failed */
vim_free(r);
}
else else
EMSG2(_("E241: Unable to send to %s"), server_name); EMSG2(_("E241: Unable to send to %s"), server_name);
return; return;
@ -8698,6 +8701,8 @@ f_remote_foreground(typval_T *argvars UNUSED, typval_T *rettv UNUSED)
argvars[1].v_type = VAR_STRING; argvars[1].v_type = VAR_STRING;
argvars[1].vval.v_string = vim_strsave((char_u *)"foreground()"); argvars[1].vval.v_string = vim_strsave((char_u *)"foreground()");
argvars[2].v_type = VAR_UNKNOWN; argvars[2].v_type = VAR_UNKNOWN;
rettv->v_type = VAR_STRING;
rettv->vval.v_string = NULL;
remote_common(argvars, rettv, TRUE); remote_common(argvars, rettv, TRUE);
vim_free(argvars[1].vval.v_string); vim_free(argvars[1].vval.v_string);
# endif # endif

View File

@ -420,6 +420,7 @@ serverSendToVim(
{ {
LookupName(dpy, loosename ? loosename : name, LookupName(dpy, loosename ? loosename : name,
/*DELETE=*/TRUE, NULL); /*DELETE=*/TRUE, NULL);
vim_free(loosename);
continue; continue;
} }
} }

View File

@ -769,6 +769,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
1079,
/**/ /**/
1078, 1078,
/**/ /**/