mirror of
				https://github.com/neovim/neovim.git
				synced 2025-10-26 12:27:24 +00:00 
			
		
		
		
	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
This commit is contained in:
		| @@ -1039,9 +1039,14 @@ static void profile_reset(void) | |||||||
|         uf->uf_tm_total     = profile_zero(); |         uf->uf_tm_total     = profile_zero(); | ||||||
|         uf->uf_tm_self      = profile_zero(); |         uf->uf_tm_self      = profile_zero(); | ||||||
|         uf->uf_tm_children  = 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_count    = NULL; | ||||||
|         uf->uf_tml_total    = NULL; |         uf->uf_tml_total    = NULL; | ||||||
|         uf->uf_tml_self     = NULL; |         uf->uf_tml_self     = NULL; | ||||||
|  |  | ||||||
|         uf->uf_tml_start    = profile_zero(); |         uf->uf_tml_start    = profile_zero(); | ||||||
|         uf->uf_tml_children = profile_zero(); |         uf->uf_tml_children = profile_zero(); | ||||||
|         uf->uf_tml_wait     = profile_zero(); |         uf->uf_tml_wait     = profile_zero(); | ||||||
| @@ -3070,6 +3075,8 @@ char_u *get_scriptname(scid_T id) | |||||||
| # if defined(EXITFREE) | # if defined(EXITFREE) | ||||||
| void free_scriptnames(void) | void free_scriptnames(void) | ||||||
| { | { | ||||||
|  |   profile_reset(); | ||||||
|  |  | ||||||
| # define FREE_SCRIPTNAME(item) xfree((item)->sn_name) | # define FREE_SCRIPTNAME(item) xfree((item)->sn_name) | ||||||
|   GA_DEEP_CLEAR(&script_items, scriptitem_T, FREE_SCRIPTNAME); |   GA_DEEP_CLEAR(&script_items, scriptitem_T, FREE_SCRIPTNAME); | ||||||
| } | } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Justin M. Keyes
					Justin M. Keyes