patch 9.1.2090: Last buffer not freed with EXITFREE
Commit:
https://github.com/vim/vim/commit/6c118afeaae756f3bbb9793e6b248517ad39a3aa
Author: zeertzjq <[email protected]>
Date: Sat Jan 17 10:13:57 2026 +0000
patch 9.1.2090: Last buffer not freed with EXITFREE
Problem: Last buffer not freed with EXITFREE (after 9.1.2087).
Solution: Free the last buffer when inside free_all_mem()
(zeertzjq).
This isn't really a memory leak, as the last buffer's memory is still
reachable via pointers like firstbuf and lastbuf. But it's possible that
this may cause false ASAN warnings in the future, which is what EXITFREE
is supposed to prevent.
closes: #19194
Signed-off-by: zeertzjq <[email protected]>
Signed-off-by: Christian Brabandt <[email protected]>
diff --git a/src/buffer.c b/src/buffer.c
index bc57a4ea2..62f236ff0 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -777,17 +777,22 @@ aucmd_abort:
// Autocommands may have opened or closed windows for this buffer.
// Decrement the count for the close we do here.
// Don't decrement b_nwindows if the buffer wasn't displayed in any window
- // before calling buf_freeall(),
+ // before calling buf_freeall().
if (nwindows > 0 && buf->b_nwindows > 0)
--buf->b_nwindows;
/*
* Remove the buffer from the list.
* Do not wipe out the buffer if it is used in a window, or if autocommands
- * wiped out all other buffers.
+ * wiped out all other buffers (unless when inside free_all_mem() where all
+ * buffers need to be freed and autocommands are blocked).
*/
if (wipe_buf && buf->b_nwindows <= 0
- && (buf->b_prev != NULL || buf->b_next != NULL))
+ && (buf->b_prev != NULL || buf->b_next != NULL
+#if defined(EXITFREE)
+ || entered_free_all_mem
+#endif
+ ))
{
tabpage_T *tp;
win_T *wp;
diff --git a/src/version.c b/src/version.c
index 157cab82c..ee2910062 100644
--- a/src/version.c
+++ b/src/version.c
@@ -734,6 +734,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 2090,
/**/
2089,
/**/
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion visit
https://groups.google.com/d/msgid/vim_dev/E1vh3Kn-00HDj7-Bk%40256bit.org.