Mercurial > vim
changeset 6747:4c4c8a53347b v7.4.696
patch 7.4.696
Problem: Not freeing memory when encountering an error.
Solution: Free the stack before returning. (Eliseo Mart?nez)
author | Bram Moolenaar <bram@vim.org> |
---|---|
date | Mon, 13 Apr 2015 15:28:12 +0200 |
parents | 121830531918 |
children | aa581f2aab3e |
files | src/regexp_nfa.c src/version.c |
diffstat | 2 files changed, 9 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- 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;