]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.2.0772: Vim9: Null dereference inside alloc_type() v9.2.0772
authorChristian Brabandt <cb@256bit.org>
Thu, 2 Jul 2026 19:36:42 +0000 (19:36 +0000)
committerChristian Brabandt <cb@256bit.org>
Thu, 2 Jul 2026 19:36:42 +0000 (19:36 +0000)
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 <cb@256bit.org>
src/version.c
src/vim9type.c

index 7fa823e7dcc2a27a3b0c8b6c7dadc8913087db44..2c4e9cf24c94ab60369de45771da93a04181c533 100644 (file)
@@ -759,6 +759,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    772,
 /**/
     771,
 /**/
index 1bd94a60cb4b4103ac171bf7456556a0e4a4e9b3..ab34d2535c122912cdfabfe71c5e50f344243d93 100644 (file)
@@ -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)