Mercurial > vim
comparison src/option.c @ 16429:a1229400434a v8.1.1219
patch 8.1.1219: not checking for NULL return from alloc()
commit https://github.com/vim/vim/commit/6ee9658774942f7448af700fc04df0335796a3db
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Apr 27 22:06:37 2019 +0200
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 https://github.com/vim/vim/issues/4303, closes https://github.com/vim/vim/issues/4174)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 27 Apr 2019 22:15:05 +0200 |
parents | 1a4da6903913 |
children | 54ffc82f38a8 |
comparison
equal
deleted
inserted
replaced
16428:6f69ef2913d7 | 16429:a1229400434a |
---|---|
13009 tabstop_copy(int *oldts) | 13009 tabstop_copy(int *oldts) |
13010 { | 13010 { |
13011 int *newts; | 13011 int *newts; |
13012 int t; | 13012 int t; |
13013 | 13013 |
13014 if (oldts == 0) | 13014 if (oldts == NULL) |
13015 return 0; | 13015 return NULL; |
13016 | 13016 newts = (int *)alloc((unsigned)((oldts[0] + 1) * sizeof(int))); |
13017 newts = (int *) alloc((unsigned) ((oldts[0] + 1) * sizeof(int))); | 13017 if (newts != NULL) |
13018 for (t = 0; t <= oldts[0]; ++t) | 13018 for (t = 0; t <= oldts[0]; ++t) |
13019 newts[t] = oldts[t]; | 13019 newts[t] = oldts[t]; |
13020 | |
13021 return newts; | 13020 return newts; |
13022 } | 13021 } |
13023 #endif | 13022 #endif |
13024 | 13023 |
13025 /* | 13024 /* |