# HG changeset patch # User Bram Moolenaar # Date 1428931692 -7200 # Node ID 4c4c8a53347b463804ad889f0b154ee0f884928f # Parent 1218305319188f12db4f5a6adc4705a174f64b1f patch 7.4.696 Problem: Not freeing memory when encountering an error. Solution: Free the stack before returning. (Eliseo Mart?nez) diff --git a/src/regexp_nfa.c b/src/regexp_nfa.c --- 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; diff --git a/src/version.c b/src/version.c --- a/src/version.c +++ b/src/version.c @@ -742,6 +742,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 696, +/**/ 695, /**/ 694,