mirror of
https://github.com/neovim/neovim.git
synced 2025-09-17 08:48:16 +00:00
vim-patch:8.2.1161: Vim9: using freed memory
Problem: Vim9: using freed memory. Solution: Put pointer back in evalarg instead of freeing it.8e2730a315
Omit eval_tofree_lambda: Vim9 script only. N/A patches for version.c: vim-patch:8.2.1163: build error Problem: Build error. Solution: Add missing change to globals.6e13530ca0
Co-authored-by: Bram Moolenaar <Bram@vim.org>
This commit is contained in:
@@ -2259,21 +2259,23 @@ static int eval_func(char **const arg, evalarg_T *const evalarg, char *const nam
|
||||
return ret;
|
||||
}
|
||||
|
||||
/// After using "evalarg" filled from "eap" free the memory.
|
||||
/// After using "evalarg" filled from "eap": free the memory.
|
||||
void clear_evalarg(evalarg_T *evalarg, exarg_T *eap)
|
||||
{
|
||||
if (evalarg != NULL && evalarg->eval_tofree != NULL) {
|
||||
if (eap != NULL) {
|
||||
// We may need to keep the original command line, e.g. for
|
||||
// ":let" it has the variable names. But we may also need the
|
||||
// new one, "nextcmd" points into it. Keep both.
|
||||
xfree(eap->cmdline_tofree);
|
||||
eap->cmdline_tofree = *eap->cmdlinep;
|
||||
*eap->cmdlinep = evalarg->eval_tofree;
|
||||
} else {
|
||||
xfree(evalarg->eval_tofree);
|
||||
if (evalarg != NULL) {
|
||||
if (evalarg->eval_tofree != NULL) {
|
||||
if (eap != NULL) {
|
||||
// We may need to keep the original command line, e.g. for
|
||||
// ":let" it has the variable names. But we may also need the
|
||||
// new one, "nextcmd" points into it. Keep both.
|
||||
xfree(eap->cmdline_tofree);
|
||||
eap->cmdline_tofree = *eap->cmdlinep;
|
||||
*eap->cmdlinep = evalarg->eval_tofree;
|
||||
} else {
|
||||
xfree(evalarg->eval_tofree);
|
||||
}
|
||||
evalarg->eval_tofree = NULL;
|
||||
}
|
||||
evalarg->eval_tofree = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user