patch 9.2.0353: Missing out-of-memory check in register.c

Commit: 
https://github.com/vim/vim/commit/7cc73a6c668e43b2018b145af235801e53b95b45
Author: John Marriott <[email protected]>
Date:   Wed Apr 15 17:54:22 2026 +0000

    patch 9.2.0353: Missing out-of-memory check in register.c
    
    Problem:  Missing out-of-memory check in register.c
    Solution: Check for memory allocation failure and return NULL
              (John Marriott).
    
    closes: #19949
    
    Signed-off-by: John Marriott <[email protected]>
    Signed-off-by: Christian Brabandt <[email protected]>

diff --git a/src/register.c b/src/register.c
index a20e5c1d0..0215f0153 100644
--- a/src/register.c
+++ b/src/register.c
@@ -352,6 +352,16 @@ get_register(
            {
                reg->y_array[i].string = 
vim_strnsave(y_current->y_array[i].string,
                                            y_current->y_array[i].length);
+               if (reg->y_array[i].string == NULL)
+               {
+                   // The allocation failed so clean up and exit
+                   while (--i >= 0)
+                       vim_free(reg->y_array[i].string);
+                   vim_free(reg->y_array);
+                   vim_free(reg);
+                   return (void *)NULL;
+               }
+
                reg->y_array[i].length = y_current->y_array[i].length;
            }
        }
diff --git a/src/version.c b/src/version.c
index 2eb306c56..2f48f475e 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 */
+/**/
+    353,
 /**/
     352,
 /**/

-- 
-- 
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/E1wD4Wy-004OGv-GM%40256bit.org.

Raspunde prin e-mail lui