Skip to content

memory leak in w_hl when reusing a popup window#19607

Closed
chrisbra wants to merge 1 commit intovim:masterfrom
chrisbra:mem-leak
Closed

memory leak in w_hl when reusing a popup window#19607
chrisbra wants to merge 1 commit intovim:masterfrom
chrisbra:mem-leak

Conversation

@chrisbra
Copy link
Member

@chrisbra chrisbra commented Mar 7, 2026

Problem: When a popup info window is reused, win_init_empty() resets
w_hl to NULL without freeing the previously allocated value,
causing a memory leak (after v9.2.0113)
Solution: Free w_hl before resetting it to NULL in win_init_empty().

Problem:  When a popup info window is reused, win_init_empty() resets
          w_hl to NULL without freeing the previously allocated value,
          causing a memory leak (after v9.2.0113)
Solution: Free w_hl before resetting it to NULL in win_init_empty().

Signed-off-by: Christian Brabandt <cb@256bit.org>
wp->w_prev_pcmark.col = 0;
wp->w_topline = 1;
// in case it was already set
vim_free(wp->w_hl);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

VIM_CLEAR(wp->w_hl) can be used here.

Copy link
Member

@yegappan yegappan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor change.

@chrisbra
Copy link
Member Author

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