diff options
author | Bram Moolenaar <Bram@vim.org> | 2018-07-29 17:40:43 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2018-07-29 17:40:43 +0200 |
commit | 79c2ad50b8069bbb3281bcabe412bd6641756724 (patch) | |
tree | 61b383cdc2fb979a3a59c6cf95effb8643ae64bf | |
parent | 92d147be959e689f8f58fd5d138a31835e160289 (diff) | |
download | vim-git-79c2ad50b8069bbb3281bcabe412bd6641756724.tar.gz |
patch 8.1.0229: crash when dumping profiling datav8.1.0229
Problem: Crash when dumping profiling data.
Solution: Reset flag indicating that initialization was done.
-rw-r--r-- | src/userfunc.c | 34 | ||||
-rw-r--r-- | src/version.c | 2 |
2 files changed, 23 insertions, 13 deletions
diff --git a/src/userfunc.c b/src/userfunc.c index 80a603b16..a8ea303a9 100644 --- a/src/userfunc.c +++ b/src/userfunc.c @@ -1102,6 +1102,21 @@ func_remove(ufunc_T *fp) return FALSE; } + static void +func_clear_items(ufunc_T *fp) +{ + ga_clear_strings(&(fp->uf_args)); + ga_clear_strings(&(fp->uf_lines)); +#ifdef FEAT_PROFILE + vim_free(fp->uf_tml_count); + fp->uf_tml_count = NULL; + vim_free(fp->uf_tml_total); + fp->uf_tml_total = NULL; + vim_free(fp->uf_tml_self); + fp->uf_tml_self = NULL; +#endif +} + /* * Free all things that a function contains. Does not free the function * itself, use func_free() for that. @@ -1115,13 +1130,7 @@ func_clear(ufunc_T *fp, int force) fp->uf_cleared = TRUE; /* clear this function */ - ga_clear_strings(&(fp->uf_args)); - ga_clear_strings(&(fp->uf_lines)); -#ifdef FEAT_PROFILE - vim_free(fp->uf_tml_count); - vim_free(fp->uf_tml_total); - vim_free(fp->uf_tml_self); -#endif + func_clear_items(fp); funccal_unref(fp->uf_scoped, fp, force); } @@ -2312,9 +2321,12 @@ ex_function(exarg_T *eap) else { /* redefine existing function */ - ga_clear_strings(&(fp->uf_args)); - ga_clear_strings(&(fp->uf_lines)); VIM_CLEAR(name); + func_clear_items(fp); +#ifdef FEAT_PROFILE + fp->uf_profiling = FALSE; + fp->uf_prof_initialized = FALSE; +#endif } } } @@ -2434,10 +2446,6 @@ ex_function(exarg_T *eap) fp->uf_scoped = NULL; #ifdef FEAT_PROFILE - fp->uf_tml_count = NULL; - fp->uf_tml_total = NULL; - fp->uf_tml_self = NULL; - fp->uf_profiling = FALSE; if (prof_def_func()) func_do_profile(fp); #endif diff --git a/src/version.c b/src/version.c index 8b31adb8b..5f7d908f1 100644 --- a/src/version.c +++ b/src/version.c @@ -795,6 +795,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 229, +/**/ 228, /**/ 227, |