Mercurial > vim
diff src/ex_eval.c @ 20996:3af71cbcfdbe v8.2.1049
patch 8.2.1049: Vim9: leaking memory when using continuation line
Commit: https://github.com/vim/vim/commit/b171fb179053fa631fec74911b5fb9374cb6a8a1
Author: Bram Moolenaar <Bram@vim.org>
Date: Wed Jun 24 20:34:03 2020 +0200
patch 8.2.1049: Vim9: leaking memory when using continuation line
Problem: Vim9: leaking memory when using continuation line.
Solution: Keep a pointer to the continuation line in evalarg_T. Centralize
checking for a next command.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Wed, 24 Jun 2020 20:45:04 +0200 |
parents | 7ee565134d4a |
children | d9e0db9b2b99 |
line wrap: on
line diff
--- a/src/ex_eval.c +++ b/src/ex_eval.c @@ -900,7 +900,7 @@ ex_eval(exarg_T *eap) evalarg.eval_flags = eap->skip ? 0 : EVAL_EVALUATE; evalarg.eval_cookie = eap->getline == getsourceline ? eap->cookie : NULL; - if (eval0(eap->arg, &tv, &eap->nextcmd, &evalarg) == OK) + if (eval0(eap->arg, &tv, eap, &evalarg) == OK) clear_tv(&tv); } @@ -929,7 +929,7 @@ ex_if(exarg_T *eap) skip = did_emsg || got_int || did_throw || (cstack->cs_idx > 0 && !(cstack->cs_flags[cstack->cs_idx - 1] & CSF_ACTIVE)); - result = eval_to_bool(eap->arg, &error, &eap->nextcmd, skip); + result = eval_to_bool(eap->arg, &error, eap, skip); if (!skip && !error) { @@ -1041,7 +1041,7 @@ ex_else(exarg_T *eap) if (eap->cmdidx == CMD_elseif) { - result = eval_to_bool(eap->arg, &error, &eap->nextcmd, skip); + result = eval_to_bool(eap->arg, &error, eap, skip); // When throwing error exceptions, we want to throw always the first // of several errors in a row. This is what actually happens when @@ -1103,7 +1103,7 @@ ex_while(exarg_T *eap) /* * ":while bool-expr" */ - result = eval_to_bool(eap->arg, &error, &eap->nextcmd, skip); + result = eval_to_bool(eap->arg, &error, eap, skip); } else { @@ -1122,7 +1122,7 @@ ex_while(exarg_T *eap) else { // Evaluate the argument and get the info in a structure. - fi = eval_for_line(eap->arg, &error, &eap->nextcmd, skip); + fi = eval_for_line(eap->arg, &error, eap, skip); cstack->cs_forinfo[cstack->cs_idx] = fi; } @@ -1322,7 +1322,7 @@ ex_throw(exarg_T *eap) char_u *value; if (*arg != NUL && *arg != '|' && *arg != '\n') - value = eval_to_string_skip(arg, &eap->nextcmd, eap->skip); + value = eval_to_string_skip(arg, eap, eap->skip); else { emsg(_(e_argreq));