vim-patch:8.1.0229: crash when dumping profiling data #10428

Problem:    Crash when dumping profiling data.
Solution:   Reset flag indicating that initialization was done.
79c2ad50b8
This commit is contained in:
Daniel Hahler 2019-07-05 22:00:28 +02:00 committed by Justin M. Keyes
parent 7535f843cd
commit 3c860e25e9

View File

@ -21256,9 +21256,10 @@ void ex_function(exarg_T *eap)
overwrite = true; overwrite = true;
} else { } else {
// redefine existing function // redefine existing function
ga_clear_strings(&(fp->uf_args));
ga_clear_strings(&(fp->uf_lines));
XFREE_CLEAR(name); XFREE_CLEAR(name);
func_clear_items(fp);
fp->uf_profiling = false;
fp->uf_prof_initialized = false;
} }
} }
} else { } else {
@ -21353,12 +21354,9 @@ void ex_function(exarg_T *eap)
} else { } else {
fp->uf_scoped = NULL; fp->uf_scoped = NULL;
} }
fp->uf_tml_count = NULL; if (prof_def_func()) {
fp->uf_tml_total = NULL;
fp->uf_tml_self = NULL;
fp->uf_profiling = FALSE;
if (prof_def_func())
func_do_profile(fp); func_do_profile(fp);
}
fp->uf_varargs = varargs; fp->uf_varargs = varargs;
if (sandbox) { if (sandbox) {
flags |= FC_SANDBOX; flags |= FC_SANDBOX;
@ -22210,6 +22208,19 @@ static bool func_remove(ufunc_T *fp)
return false; return false;
} }
static void func_clear_items(ufunc_T *fp)
{
ga_clear_strings(&(fp->uf_args));
ga_clear_strings(&(fp->uf_lines));
xfree(fp->uf_tml_count);
fp->uf_tml_count = NULL;
xfree(fp->uf_tml_total);
fp->uf_tml_total = NULL;
xfree(fp->uf_tml_self);
fp->uf_tml_self = NULL;
}
/// Free all things that a function contains. Does not free the function /// Free all things that a function contains. Does not free the function
/// itself, use func_free() for that. /// itself, use func_free() for that.
/// ///
@ -22222,11 +22233,7 @@ static void func_clear(ufunc_T *fp, bool force)
fp->uf_cleared = true; fp->uf_cleared = true;
// clear this function // clear this function
ga_clear_strings(&(fp->uf_args)); func_clear_items(fp);
ga_clear_strings(&(fp->uf_lines));
xfree(fp->uf_tml_count);
xfree(fp->uf_tml_total);
xfree(fp->uf_tml_self);
funccal_unref(fp->uf_scoped, fp, force); funccal_unref(fp->uf_scoped, fp, force);
} }