Mercurial > vim
comparison src/ops.c @ 17797:ec1717981acf v8.1.1895
patch 8.1.1895: using NULL pointer when out of memory
commit https://github.com/vim/vim/commit/6f10c70b59fa4e56aa479345fb0caeaac7429bfb
Author: Bram Moolenaar <Bram@vim.org>
Date: Tue Aug 20 22:58:37 2019 +0200
patch 8.1.1895: using NULL pointer when out of memory
Problem: Using NULL pointer when out of memory.
Solution: Bail out or skip the code using the pointer. (Zu-Ming Jiang,
closes #4805, closes #4843, closes #4939, closes #4844)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Tue, 20 Aug 2019 23:00:04 +0200 |
parents | 0f7ae8010787 |
children | 0b351691071c |
comparison
equal
deleted
inserted
replaced
17796:9ebba5c49827 | 17797:ec1717981acf |
---|---|
4554 /* store the column position before last line */ | 4554 /* store the column position before last line */ |
4555 col = sumsize - currsize - spaces[count - 1]; | 4555 col = sumsize - currsize - spaces[count - 1]; |
4556 | 4556 |
4557 /* allocate the space for the new line */ | 4557 /* allocate the space for the new line */ |
4558 newp = alloc(sumsize + 1); | 4558 newp = alloc(sumsize + 1); |
4559 if (newp == NULL) | |
4560 { | |
4561 ret = FAIL; | |
4562 goto theend; | |
4563 } | |
4559 cend = newp + sumsize; | 4564 cend = newp + sumsize; |
4560 *cend = 0; | 4565 *cend = 0; |
4561 | 4566 |
4562 #ifdef FEAT_TEXT_PROP | 4567 #ifdef FEAT_TEXT_PROP |
4563 // We need to move properties of the lines that are going to be deleted to | 4568 // We need to move properties of the lines that are going to be deleted to |