patch 9.2.0801: Memory leak in f_getreginfo() on alloc failure
Commit:
https://github.com/vim/vim/commit/8e54a347396fad8137afcf3a27e4f5e187d8513d
Author: Yasuhiro Matsumoto <
matt...@gmail.com>
Date: Sat Jul 18 14:35:21 2026 +0000
patch 9.2.0801: Memory leak in f_getreginfo() on alloc failure
Problem: Memory leak in f_getreginfo() on alloc failure
Solution: Call list_unref() with list var (Yasuhiro Matsumoto).
Since dict_add_list() leaves ownership with the caller on failure, the
freshly built list must be freed when the add fails.
related: #20668
related: #20745
Signed-off-by: Yasuhiro Matsumoto <
matt...@gmail.com>
Signed-off-by: Christian Brabandt <
c...@256bit.org>
diff --git a/src/evalfunc.c b/src/evalfunc.c
index 15b1eee87..de52668e5 100644
--- a/src/evalfunc.c
+++ b/src/evalfunc.c
@@ -10569,7 +10569,8 @@ f_getreginfo(typval_T *argvars, typval_T *rettv)
list = (list_T *)get_reg_contents(regname, GREG_EXPR_SRC | GREG_LIST);
if (list == NULL)
return;
- (void)dict_add_list(dict, "regcontents", list);
+ if (dict_add_list(dict, "regcontents", list) == FAIL)
+ list_unref(list);
switch (get_reg_type(regname, ®len))
{
diff --git a/src/version.c b/src/version.c
index 801fd4179..e5eaed8d9 100644
--- a/src/version.c
+++ b/src/version.c
@@ -759,6 +759,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 801,
/**/
800,
/**/