aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorerw7 <erw7.github@gmail.com>2020-05-08 12:05:34 +0900
committererw7 <erw7.github@gmail.com>2020-05-09 11:21:52 +0900
commit861aade680925a240e6f5ae2ba29513abc1eb8f6 (patch)
treee3770b63c3a51035d1e85997dcc19845d493c897
parent9a67b030d9a054648296b45b615684dee768582d (diff)
downloadrneovim-861aade680925a240e6f5ae2ba29513abc1eb8f6.tar.gz
rneovim-861aade680925a240e6f5ae2ba29513abc1eb8f6.tar.bz2
rneovim-861aade680925a240e6f5ae2ba29513abc1eb8f6.zip
viml/profile: fix use after free
fixes #12255.
-rw-r--r--src/nvim/ex_cmds2.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/nvim/ex_cmds2.c b/src/nvim/ex_cmds2.c
index fbdd64e43e..a6bc32581f 100644
--- a/src/nvim/ex_cmds2.c
+++ b/src/nvim/ex_cmds2.c
@@ -1045,9 +1045,10 @@ static void profile_reset(void)
uf->uf_tm_self = profile_zero();
uf->uf_tm_children = profile_zero();
- XFREE_CLEAR(uf->uf_tml_count);
- XFREE_CLEAR(uf->uf_tml_total);
- XFREE_CLEAR(uf->uf_tml_self);
+ for (int i = 0; i < uf->uf_lines.ga_len; i++) {
+ uf->uf_tml_count[i] = 0;
+ uf->uf_tml_total[i] = uf->uf_tml_self[i] = 0;
+ }
uf->uf_tml_start = profile_zero();
uf->uf_tml_children = profile_zero();