diff options
Diffstat (limited to 'src/vim9compile.c')
-rw-r--r-- | src/vim9compile.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/vim9compile.c b/src/vim9compile.c index 4a55f1973..0ada441a4 100644 --- a/src/vim9compile.c +++ b/src/vim9compile.c @@ -8486,6 +8486,7 @@ compile_def_function( cctx_T *outer_cctx) { char_u *line = NULL; + char_u *line_to_free = NULL; char_u *p; char *errormsg = NULL; // error message cctx_T cctx; @@ -8647,6 +8648,14 @@ compile_def_function( #endif break; } + // Make a copy, splitting off nextcmd and removing trailing spaces + // may change it. + if (line != NULL) + { + line = vim_strsave(line); + vim_free(line_to_free); + line_to_free = line; + } } CLEAR_FIELD(ea); @@ -9095,6 +9104,7 @@ erret: if (do_estack_push) estack_pop(); + vim_free(line_to_free); free_imported(&cctx); free_locals(&cctx); ga_clear(&cctx.ctx_type_stack); |