comparison src/evalfunc.c @ 12399:de1ae9d8ef57 v8.0.1079

patch 8.0.1079: memory leak when remote_foreground() fails commit https://github.com/vim/vim/commit/09d6c3818d7451a659f4d12a4e974237fe823f7d Author: Bram Moolenaar <Bram@vim.org> Date: Sat Sep 9 16:25:54 2017 +0200 patch 8.0.1079: memory leak when remote_foreground() fails Problem: Memory leak when remote_foreground() fails. Solution: Free the error message.
author Christian Brabandt <cb@256bit.org>
date Sat, 09 Sep 2017 16:30:04 +0200
parents d0cf7f71b95b
children fc3e2d5614dd
comparison
equal deleted inserted replaced
12398:eac3e2671dc8 12399:de1ae9d8ef57
8636 if (serverSendToVim(X_DISPLAY, server_name, keys, &r, &w, expr, timeout, 8636 if (serverSendToVim(X_DISPLAY, server_name, keys, &r, &w, expr, timeout,
8637 0, TRUE) < 0) 8637 0, TRUE) < 0)
8638 # endif 8638 # endif
8639 { 8639 {
8640 if (r != NULL) 8640 if (r != NULL)
8641 {
8641 EMSG(r); /* sending worked but evaluation failed */ 8642 EMSG(r); /* sending worked but evaluation failed */
8643 vim_free(r);
8644 }
8642 else 8645 else
8643 EMSG2(_("E241: Unable to send to %s"), server_name); 8646 EMSG2(_("E241: Unable to send to %s"), server_name);
8644 return; 8647 return;
8645 } 8648 }
8646 8649
8696 # else 8699 # else
8697 /* Send a foreground() expression to the server. */ 8700 /* Send a foreground() expression to the server. */
8698 argvars[1].v_type = VAR_STRING; 8701 argvars[1].v_type = VAR_STRING;
8699 argvars[1].vval.v_string = vim_strsave((char_u *)"foreground()"); 8702 argvars[1].vval.v_string = vim_strsave((char_u *)"foreground()");
8700 argvars[2].v_type = VAR_UNKNOWN; 8703 argvars[2].v_type = VAR_UNKNOWN;
8704 rettv->v_type = VAR_STRING;
8705 rettv->vval.v_string = NULL;
8701 remote_common(argvars, rettv, TRUE); 8706 remote_common(argvars, rettv, TRUE);
8702 vim_free(argvars[1].vval.v_string); 8707 vim_free(argvars[1].vval.v_string);
8703 # endif 8708 # endif
8704 #endif 8709 #endif
8705 } 8710 }