Skip to content

Commit c8fe338

Browse files
committed
patch 7.4.2327
Problem: Freeing a variable that is on the stack. Solution: Don't free res_tv or err_tv. (Ozaki Kiichi)
1 parent d5824ce commit c8fe338

2 files changed

Lines changed: 5 additions & 7 deletions

File tree

src/channel.c

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2142,7 +2142,7 @@ channel_exe_cmd(channel_T *channel, int part, typval_T *argv)
21422142
}
21432143
else
21442144
{
2145-
typval_T *tv;
2145+
typval_T *tv = NULL;
21462146
typval_T res_tv;
21472147
typval_T err_tv;
21482148
char_u *json = NULL;
@@ -2159,8 +2159,6 @@ channel_exe_cmd(channel_T *channel, int part, typval_T *argv)
21592159
ch_logs(channel, "Calling '%s'", (char *)arg);
21602160
if (func_call(arg, &argv[2], NULL, NULL, &res_tv) == OK)
21612161
tv = &res_tv;
2162-
else
2163-
tv = NULL;
21642162
}
21652163

21662164
if (argv[id_idx].v_type == VAR_NUMBER)
@@ -2174,11 +2172,9 @@ channel_exe_cmd(channel_T *channel, int part, typval_T *argv)
21742172
/* If evaluation failed or the result can't be encoded
21752173
* then return the string "ERROR". */
21762174
vim_free(json);
2177-
free_tv(tv);
21782175
err_tv.v_type = VAR_STRING;
21792176
err_tv.vval.v_string = (char_u *)"ERROR";
2180-
tv = &err_tv;
2181-
json = json_encode_nr_expr(id, tv, options | JSON_NL);
2177+
json = json_encode_nr_expr(id, &err_tv, options | JSON_NL);
21822178
}
21832179
if (json != NULL)
21842180
{
@@ -2191,7 +2187,7 @@ channel_exe_cmd(channel_T *channel, int part, typval_T *argv)
21912187
--emsg_skip;
21922188
if (tv == &res_tv)
21932189
clear_tv(tv);
2194-
else if (tv != &err_tv)
2190+
else
21952191
free_tv(tv);
21962192
}
21972193
}

src/version.c

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

764764
static int included_patches[] =
765765
{ /* Add new patch number below this line */
766+
/**/
767+
2327,
766768
/**/
767769
2326,
768770
/**/

0 commit comments

Comments
 (0)