]> granicus.if.org Git - vim/commitdiff
patch 8.0.1079: memory leak when remote_foreground() fails v8.0.1079
authorBram Moolenaar <Bram@vim.org>
Sat, 9 Sep 2017 14:25:54 +0000 (16:25 +0200)
committerBram Moolenaar <Bram@vim.org>
Sat, 9 Sep 2017 14:25:54 +0000 (16:25 +0200)
Problem:    Memory leak when remote_foreground() fails.
Solution:   Free the error message.

src/evalfunc.c
src/if_xcmdsrv.c
src/version.c

index a2542e2c5ee4f4d03cd48208cd44a1dd09c9ce8c..ea342b4c65991777a43cdf3ad25656e04c1ff3bb 100644 (file)
@@ -8638,7 +8638,10 @@ remote_common(typval_T *argvars, typval_T *rettv, int expr)
 # 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 @@ f_remote_foreground(typval_T *argvars UNUSED, typval_T *rettv UNUSED)
     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
index 4c3c0122024fc305ea8c714935800b68f738bc82..2d87e305011fe05dcb367dcf048cac006d06b0d6 100644 (file)
@@ -420,6 +420,7 @@ serverSendToVim(
            {
                LookupName(dpy, loosename ? loosename : name,
                           /*DELETE=*/TRUE, NULL);
+               vim_free(loosename);
                continue;
            }
        }
index 4ef0d9ee716725b5bb450db1c52102cbe3881b99..94ba24dbbe8173ebb5ad83ff191c8f6aa0d4a59a 100644 (file)
@@ -769,6 +769,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1079,
 /**/
     1078,
 /**/