patch 9.2.0772: Vim9: Null dereference inside alloc_type()
Commit:
https://github.com/vim/vim/commit/d5ec9f2e2c8694f12ba16eef1ce0fe002445bd37
Author: Christian Brabandt <
c...@256bit.org>
Date: Thu Jul 2 19:36:42 2026 +0000
patch 9.2.0772: Vim9: Null dereference inside alloc_type()
Problem: Vim9: Null dereference inside alloc_type(),
Missing NULL check after ALLOC_ONE() (Ao Xijie)
Solution: Check that the returned value from ALLOC_ONE() is not NULL
related: #20668
Supported by AI.
Signed-off-by: Christian Brabandt <
c...@256bit.org>
diff --git a/src/version.c b/src/version.c
index 7fa823e7d..2c4e9cf24 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 */
+/**/
+ 772,
/**/
771,
/**/
diff --git a/src/vim9type.c b/src/vim9type.c
index 1bd94a60c..ab34d2535 100644
--- a/src/vim9type.c
+++ b/src/vim9type.c
@@ -147,6 +147,8 @@ alloc_type(type_T *type)
return type;
ret = ALLOC_ONE(type_T);
+ if (ret == NULL)
+ return NULL;
*ret = *type;
if (ret->tt_member != NULL)