commit e5ba875a956c0f4a22d7e157538f24511139984a
parent 2415d8f4247e01346a08487f290c44d01ef01f21
Author: shadmansaleh <13149513+shadmansaleh@users.noreply.github.com>
Date: Thu, 4 Sep 2025 20:36:56 +0600
fix(progress): memory leak on progress-message with history=false
Diffstat:
1 file changed, 6 insertions(+), 0 deletions(-)
diff --git a/src/nvim/message.c b/src/nvim/message.c
@@ -352,6 +352,7 @@ MsgID msg_multihl(MsgID id, HlMessage hl_msg, const char *kind, bool history, bo
msg_start();
msg_clr_eos();
bool need_clear = false;
+ bool hl_msg_updated = false;
msg_ext_history = history;
if (kind != NULL) {
msg_ext_set_kind(kind);
@@ -375,6 +376,7 @@ MsgID msg_multihl(MsgID id, HlMessage hl_msg, const char *kind, bool history, bo
HlMessage formated_message = format_progress_message(hl_msg, msg_data);
if (formated_message.items != hl_msg.items) {
*needs_msg_clear = true;
+ hl_msg_updated = true;
hl_msg = formated_message;
}
}
@@ -397,6 +399,10 @@ MsgID msg_multihl(MsgID id, HlMessage hl_msg, const char *kind, bool history, bo
is_multihl = false;
no_wait_return--;
msg_end();
+
+ if (hl_msg_updated && !(history && kv_size(hl_msg))) {
+ hl_msg_free(hl_msg);
+ }
return id;
}