Skip to content

Commit 79c2ad5

Browse files
committed
patch 8.1.0229: crash when dumping profiling data
Problem: Crash when dumping profiling data. Solution: Reset flag indicating that initialization was done.
1 parent 92d147b commit 79c2ad5

File tree

2 files changed

+23
-13
lines changed

2 files changed

+23
-13
lines changed

src/userfunc.c

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1102,6 +1102,21 @@ func_remove(ufunc_T *fp)
11021102
return FALSE;
11031103
}
11041104

1105+
static void
1106+
func_clear_items(ufunc_T *fp)
1107+
{
1108+
ga_clear_strings(&(fp->uf_args));
1109+
ga_clear_strings(&(fp->uf_lines));
1110+
#ifdef FEAT_PROFILE
1111+
vim_free(fp->uf_tml_count);
1112+
fp->uf_tml_count = NULL;
1113+
vim_free(fp->uf_tml_total);
1114+
fp->uf_tml_total = NULL;
1115+
vim_free(fp->uf_tml_self);
1116+
fp->uf_tml_self = NULL;
1117+
#endif
1118+
}
1119+
11051120
/*
11061121
* Free all things that a function contains. Does not free the function
11071122
* itself, use func_free() for that.
@@ -1115,13 +1130,7 @@ func_clear(ufunc_T *fp, int force)
11151130
fp->uf_cleared = TRUE;
11161131

11171132
/* clear this function */
1118-
ga_clear_strings(&(fp->uf_args));
1119-
ga_clear_strings(&(fp->uf_lines));
1120-
#ifdef FEAT_PROFILE
1121-
vim_free(fp->uf_tml_count);
1122-
vim_free(fp->uf_tml_total);
1123-
vim_free(fp->uf_tml_self);
1124-
#endif
1133+
func_clear_items(fp);
11251134
funccal_unref(fp->uf_scoped, fp, force);
11261135
}
11271136

@@ -2312,9 +2321,12 @@ ex_function(exarg_T *eap)
23122321
else
23132322
{
23142323
/* redefine existing function */
2315-
ga_clear_strings(&(fp->uf_args));
2316-
ga_clear_strings(&(fp->uf_lines));
23172324
VIM_CLEAR(name);
2325+
func_clear_items(fp);
2326+
#ifdef FEAT_PROFILE
2327+
fp->uf_profiling = FALSE;
2328+
fp->uf_prof_initialized = FALSE;
2329+
#endif
23182330
}
23192331
}
23202332
}
@@ -2434,10 +2446,6 @@ ex_function(exarg_T *eap)
24342446
fp->uf_scoped = NULL;
24352447

24362448
#ifdef FEAT_PROFILE
2437-
fp->uf_tml_count = NULL;
2438-
fp->uf_tml_total = NULL;
2439-
fp->uf_tml_self = NULL;
2440-
fp->uf_profiling = FALSE;
24412449
if (prof_def_func())
24422450
func_do_profile(fp);
24432451
#endif

src/version.c

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

795795
static int included_patches[] =
796796
{ /* Add new patch number below this line */
797+
/**/
798+
229,
797799
/**/
798800
228,
799801
/**/

0 commit comments

Comments
 (0)