mirror of
https://github.com/vim/vim.git
synced 2025-09-24 03:44:06 -04:00
patch 8.1.1219: not checking for NULL return from alloc()
Problem: Not checking for NULL return from alloc(). Solution: Add checks. (Martin Kunev, closes #4303, closes #4174)
This commit is contained in:
13
src/option.c
13
src/option.c
@@ -13011,13 +13011,12 @@ tabstop_copy(int *oldts)
|
||||
int *newts;
|
||||
int t;
|
||||
|
||||
if (oldts == 0)
|
||||
return 0;
|
||||
|
||||
newts = (int *) alloc((unsigned) ((oldts[0] + 1) * sizeof(int)));
|
||||
for (t = 0; t <= oldts[0]; ++t)
|
||||
newts[t] = oldts[t];
|
||||
|
||||
if (oldts == NULL)
|
||||
return NULL;
|
||||
newts = (int *)alloc((unsigned)((oldts[0] + 1) * sizeof(int)));
|
||||
if (newts != NULL)
|
||||
for (t = 0; t <= oldts[0]; ++t)
|
||||
newts[t] = oldts[t];
|
||||
return newts;
|
||||
}
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user