aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2017-10-29 20:03:17 +0100
committerJustin M. Keyes <justinkz@gmail.com>2017-10-30 08:37:59 +0100
commitcc7285823cda56aeb1ce16e03990c3397e315a2e (patch)
tree59845be91ce3fd8681b3a10e3569bdd99a6a57a5
parent1e2ae942f303e149ec7e69e1ca36c7defa21f65d (diff)
downloadrneovim-cc7285823cda56aeb1ce16e03990c3397e315a2e.tar.gz
rneovim-cc7285823cda56aeb1ce16e03990c3397e315a2e.tar.bz2
rneovim-cc7285823cda56aeb1ce16e03990c3397e315a2e.zip
eval_clear: free profile data
Memory leak exposed by new test added in #7444. ==38771==ERROR: LeakSanitizer: detected memory leaks Direct leak of 2400 byte(s) in 1 object(s) allocated from: 0 0x51163d in realloc (/home/travis/build/neovim/neovim/build/bin/nvim+0x51163d) 1 0xfda51c in xrealloc /home/travis/build/neovim/neovim/src/nvim/memory.c:169:15 2 0xda6802 in ga_grow /home/travis/build/neovim/neovim/src/nvim/garray.c:98:14 3 0xb67ccd in script_line_start /home/travis/build/neovim/neovim/src/nvim/ex_cmds2.c:3286:11 4 0xb62885 in getsourceline /home/travis/build/neovim/neovim/src/nvim/ex_cmds2.c:3110:5 5 0xb5fbfd in do_source /home/travis/build/neovim/neovim/src/nvim/ex_cmds2.c:2951:15 6 0xb5c484 in cmd_source /home/travis/build/neovim/neovim/src/nvim/ex_cmds2.c:2710:14 7 0xb5c5b0 in ex_source /home/travis/build/neovim/neovim/src/nvim/ex_cmds2.c:2691:3 8 0xb950b9 in do_one_cmd /home/travis/build/neovim/neovim/src/nvim/ex_docmd.c:2242:5 9 0xb737e1 in do_cmdline /home/travis/build/neovim/neovim/src/nvim/ex_docmd.c:609:20 10 0xb79ac5 in do_cmdline_cmd /home/travis/build/neovim/neovim/src/nvim/ex_docmd.c:280:10 11 0xed8a7b in exe_commands /home/travis/build/neovim/neovim/src/nvim/main.c:1684:5 12 0xec6602 in main /home/travis/build/neovim/neovim/src/nvim/main.c:521:5 13 0x2ae968600f44 in __libc_start_main /build/eglibc-SvCtMH/eglibc-2.19/csu/libc-start.c:287
-rw-r--r--src/nvim/ex_cmds2.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/nvim/ex_cmds2.c b/src/nvim/ex_cmds2.c
index 19e7f1bbc5..9b8e463aee 100644
--- a/src/nvim/ex_cmds2.c
+++ b/src/nvim/ex_cmds2.c
@@ -1039,9 +1039,14 @@ static void profile_reset(void)
uf->uf_tm_total = profile_zero();
uf->uf_tm_self = profile_zero();
uf->uf_tm_children = profile_zero();
+
+ xfree(uf->uf_tml_count);
+ xfree(uf->uf_tml_total);
+ xfree(uf->uf_tml_self);
uf->uf_tml_count = NULL;
uf->uf_tml_total = NULL;
uf->uf_tml_self = NULL;
+
uf->uf_tml_start = profile_zero();
uf->uf_tml_children = profile_zero();
uf->uf_tml_wait = profile_zero();
@@ -3070,6 +3075,8 @@ char_u *get_scriptname(scid_T id)
# if defined(EXITFREE)
void free_scriptnames(void)
{
+ profile_reset();
+
# define FREE_SCRIPTNAME(item) xfree((item)->sn_name)
GA_DEEP_CLEAR(&script_items, scriptitem_T, FREE_SCRIPTNAME);
}