mirror of
https://github.com/neovim/neovim.git
synced 2025-09-13 14:58:18 +00:00
vim-patch:8.1.1946: memory error when profiling a function without a script ID
Problem: Memory error when profiling a function without a script ID.
Solution: Check for missing script ID. (closes vim/vim#4877)
163588005d
This commit is contained in:
@@ -22147,16 +22147,18 @@ void func_dump_profile(FILE *fd)
|
||||
} else {
|
||||
fprintf(fd, "FUNCTION %s()\n", fp->uf_name);
|
||||
}
|
||||
bool should_free;
|
||||
const LastSet last_set = (LastSet){
|
||||
.script_ctx = fp->uf_script_ctx,
|
||||
.channel_id = 0,
|
||||
};
|
||||
char_u *p = get_scriptname(last_set, &should_free);
|
||||
fprintf(fd, " Defined: %s line %" PRIdLINENR "\n",
|
||||
p, fp->uf_script_ctx.sc_lnum);
|
||||
if (should_free) {
|
||||
xfree(p);
|
||||
if (fp->uf_script_ctx.sc_sid != 0) {
|
||||
bool should_free;
|
||||
const LastSet last_set = (LastSet){
|
||||
.script_ctx = fp->uf_script_ctx,
|
||||
.channel_id = 0,
|
||||
};
|
||||
char_u *p = get_scriptname(last_set, &should_free);
|
||||
fprintf(fd, " Defined: %s line %" PRIdLINENR "\n",
|
||||
p, fp->uf_script_ctx.sc_lnum);
|
||||
if (should_free) {
|
||||
xfree(p);
|
||||
}
|
||||
}
|
||||
if (fp->uf_tm_count == 1) {
|
||||
fprintf(fd, "Called 1 time\n");
|
||||
|
Reference in New Issue
Block a user