aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJan Edmund Lazo <janedmundlazo@hotmail.com>2018-08-10 09:33:48 -0400
committerJan Edmund Lazo <janedmundlazo@hotmail.com>2018-08-11 14:32:59 -0400
commitdd6c1a0a8f14aed30816aae6a354f2056bfbf15f (patch)
treedbcf204d660f73faa031f880e4dcc2e9d1c85f89 /src
parent22311457ab60be9335f8e630c8b794340d39e466 (diff)
downloadrneovim-dd6c1a0a8f14aed30816aae6a354f2056bfbf15f.tar.gz
rneovim-dd6c1a0a8f14aed30816aae6a354f2056bfbf15f.tar.bz2
rneovim-dd6c1a0a8f14aed30816aae6a354f2056bfbf15f.zip
vim-patch:8.0.0828: Coverity: may dereference NULL pointer
Problem: Coverity: may dereference NULL pointer. Solution: Bail out if calloc_state() returns NULL. https://github.com/vim/vim/commit/983b3a5bc44a91cc7e40b8e71e3bfdb03dd4606f
Diffstat (limited to 'src')
-rw-r--r--src/nvim/regexp_nfa.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/nvim/regexp_nfa.c b/src/nvim/regexp_nfa.c
index deef3042d2..dcd89d1470 100644
--- a/src/nvim/regexp_nfa.c
+++ b/src/nvim/regexp_nfa.c
@@ -3224,7 +3224,13 @@ static nfa_state_T *post2nfa(int *postfix, int *end, int nfa_calc_size)
if (pattern) {
/* NFA_ZEND -> NFA_END_PATTERN -> NFA_SKIP -> what follows. */
skip = alloc_state(NFA_SKIP, NULL, NULL);
+ if (skip == NULL) {
+ goto theend;
+ }
zend = alloc_state(NFA_ZEND, s1, NULL);
+ if (zend == NULL) {
+ goto theend;
+ }
s1->out= skip;
patch(e.out, zend);
PUSH(frag(s, list1(&skip->out)));