Skip to content

Commit 09d6c38

Browse files
committed
patch 8.0.1079: memory leak when remote_foreground() fails
Problem: Memory leak when remote_foreground() fails. Solution: Free the error message.
1 parent b4ea191 commit 09d6c38

3 files changed

Lines changed: 8 additions & 0 deletions

File tree

src/evalfunc.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8638,7 +8638,10 @@ remote_common(typval_T *argvars, typval_T *rettv, int expr)
86388638
# endif
86398639
{
86408640
if (r != NULL)
8641+
{
86418642
EMSG(r); /* sending worked but evaluation failed */
8643+
vim_free(r);
8644+
}
86428645
else
86438646
EMSG2(_("E241: Unable to send to %s"), server_name);
86448647
return;
@@ -8698,6 +8701,8 @@ f_remote_foreground(typval_T *argvars UNUSED, typval_T *rettv UNUSED)
86988701
argvars[1].v_type = VAR_STRING;
86998702
argvars[1].vval.v_string = vim_strsave((char_u *)"foreground()");
87008703
argvars[2].v_type = VAR_UNKNOWN;
8704+
rettv->v_type = VAR_STRING;
8705+
rettv->vval.v_string = NULL;
87018706
remote_common(argvars, rettv, TRUE);
87028707
vim_free(argvars[1].vval.v_string);
87038708
# endif

src/if_xcmdsrv.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -420,6 +420,7 @@ serverSendToVim(
420420
{
421421
LookupName(dpy, loosename ? loosename : name,
422422
/*DELETE=*/TRUE, NULL);
423+
vim_free(loosename);
423424
continue;
424425
}
425426
}

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -769,6 +769,8 @@ static char *(features[]) =
769769

770770
static int included_patches[] =
771771
{ /* Add new patch number below this line */
772+
/**/
773+
1079,
772774
/**/
773775
1078,
774776
/**/

0 commit comments

Comments
 (0)