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 <basilisk@internode.on.net>
Signed-off-by: Christian Brabandt <cb@256bit.org>
{
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;
}
}
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 353,
/**/
352,
/**/