Skip to content

Fix memory leak and don't initialize to w_hl to NULL in win_init_empty()#19609

Closed
64-bitman wants to merge 1 commit intovim:masterfrom
64-bitman:whl_memory_leak
Closed

Fix memory leak and don't initialize to w_hl to NULL in win_init_empty()#19609
64-bitman wants to merge 1 commit intovim:masterfrom
64-bitman:whl_memory_leak

Conversation

@64-bitman
Copy link
Contributor

  • By setting w_hl to NULL in win_init_empty(), switching to a new file (e.g. :e file) will clear all window local highlights for the window.

  • Fix memory leak found in ASAN CI test

@chrisbra
Copy link
Member

chrisbra commented Mar 7, 2026

should be fixed already by #19607

@64-bitman
Copy link
Contributor Author

64-bitman commented Mar 7, 2026

should be fixed already by #19607

This PR also calls remove_highlight_overrides() before freeing the w_hl

EDIT: Actually #19607 is wrong, win_init_empty() should not initialize w_hl to NULL

@chrisbra
Copy link
Member

chrisbra commented Mar 7, 2026

okay, can you update this PR?

@64-bitman
Copy link
Contributor Author

okay, can you update this PR?

Done

@chrisbra
Copy link
Member

chrisbra commented Mar 7, 2026

Thansk. I was actually wondering if vim_init_empty() should clear the 'winhighlight' pointers or not.

@64-bitman
Copy link
Contributor Author

@chrisbra Can you not merge this PR yet? I think I found the real source of the crash I've been experiencing

@64-bitman 64-bitman force-pushed the whl_memory_leak branch 2 times, most recently from 732d0f3 to 2d4b34c Compare March 7, 2026 18:11
@64-bitman
Copy link
Contributor Author

Okay I think this can be merged now.

@chrisbra chrisbra closed this in 6495ca4 Mar 7, 2026
@chrisbra
Copy link
Member

chrisbra commented Mar 7, 2026

thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants