diff options
author | Eliseo Martínez <eliseomarmol@gmail.com> | 2015-02-11 19:47:43 +0100 |
---|---|---|
committer | Eliseo Martínez <eliseomarmol@gmail.com> | 2015-02-11 19:47:43 +0100 |
commit | e177357fc8da94571d7c476d2260928dc2a8b948 (patch) | |
tree | 4473f187297541923193b9d271438a7697c2982a /src/nvim/regexp_nfa.c | |
parent | 5976251bb91a7d3967cf268f0eeed1f5d756ba7a (diff) | |
parent | bbfaa78dcdc1f4e3e7631c5ce6f4937bf932dc20 (diff) | |
download | rneovim-e177357fc8da94571d7c476d2260928dc2a8b948.tar.gz rneovim-e177357fc8da94571d7c476d2260928dc2a8b948.tar.bz2 rneovim-e177357fc8da94571d7c476d2260928dc2a8b948.zip |
Merge #1947: Fix coverity issues. (4)
Diffstat (limited to 'src/nvim/regexp_nfa.c')
-rw-r--r-- | src/nvim/regexp_nfa.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/src/nvim/regexp_nfa.c b/src/nvim/regexp_nfa.c index b082903282..99e9c3afec 100644 --- a/src/nvim/regexp_nfa.c +++ b/src/nvim/regexp_nfa.c @@ -2887,6 +2887,7 @@ static nfa_state_T *post2nfa(int *postfix, int *end, int nfa_calc_size) if (stackp < stack) \ { \ st_error(postfix, end, p); \ + free(stack); \ return NULL; \ } @@ -3316,13 +3317,17 @@ static nfa_state_T *post2nfa(int *postfix, int *end, int nfa_calc_size) } e = POP(); - if (stackp != stack) - EMSG_RET_NULL(_( - "E875: (NFA regexp) (While converting from postfix to NFA), too many states left on stack")); + if (stackp != stack) { + free(stack); + EMSG_RET_NULL(_("E875: (NFA regexp) (While converting from postfix to NFA)," + "too many states left on stack")); + } - if (istate >= nstate) - EMSG_RET_NULL(_( - "E876: (NFA regexp) Not enough space to store the whole NFA ")); + if (istate >= nstate) { + 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; |