diff options
author | Bram Moolenaar <Bram@vim.org> | 2015-04-13 15:28:12 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2015-04-13 15:28:12 +0200 |
commit | 50ab994ab34fcbe0046a9a998ee420be196334ba (patch) | |
tree | c75c1642431da3702b039b156afc6a7e24e2b998 /src/regexp_nfa.c | |
parent | 7c94ce910f07e0d76d66b46bccfe39a07d8e1f6d (diff) | |
download | vim-git-50ab994ab34fcbe0046a9a998ee420be196334ba.tar.gz |
patch 7.4.696v7.4.696
Problem: Not freeing memory when encountering an error.
Solution: Free the stack before returning. (Eliseo MartÃnez)
Diffstat (limited to 'src/regexp_nfa.c')
-rw-r--r-- | src/regexp_nfa.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/regexp_nfa.c b/src/regexp_nfa.c index e67f6380c..825f960ca 100644 --- a/src/regexp_nfa.c +++ b/src/regexp_nfa.c @@ -3156,6 +3156,7 @@ post2nfa(postfix, end, nfa_calc_size) if (stackp < stack) \ { \ st_error(postfix, end, p); \ + vim_free(stack); \ return NULL; \ } @@ -3632,10 +3633,16 @@ post2nfa(postfix, end, nfa_calc_size) e = POP(); if (stackp != stack) + { + vim_free(stack); EMSG_RET_NULL(_("E875: (NFA regexp) (While converting from postfix to NFA), too many states left on stack")); + } if (istate >= nstate) + { + vim_free(stack); EMSG_RET_NULL(_("E876: (NFA regexp) Not enough space to store the whole NFA ")); + } matchstate = &state_ptr[istate++]; /* the match state */ matchstate->c = NFA_MATCH; |