diff options
author | Bram Moolenaar <Bram@vim.org> | 2019-04-27 22:06:37 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2019-04-27 22:06:37 +0200 |
commit | 6ee9658774942f7448af700fc04df0335796a3db (patch) | |
tree | 87f99c37e22f07e73e244da78686c7e59a8457f1 /src/option.c | |
parent | 00aa069db8132851a91cfc5ca7f58ef945c75c73 (diff) | |
download | vim-git-6ee9658774942f7448af700fc04df0335796a3db.tar.gz |
patch 8.1.1219: not checking for NULL return from alloc()v8.1.1219
Problem: Not checking for NULL return from alloc().
Solution: Add checks. (Martin Kunev, closes #4303, closes #4174)
Diffstat (limited to 'src/option.c')
-rw-r--r-- | src/option.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/src/option.c b/src/option.c index ba12fd4e6..dfd4587c3 100644 --- a/src/option.c +++ b/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 |