0
0
mirror of https://github.com/vim/vim.git synced 2025-10-09 06:14:17 -04:00

patch 7.4.696

Problem:    Not freeing memory when encountering an error.
Solution:   Free the stack before returning. (Eliseo Martínez)
This commit is contained in:
Bram Moolenaar
2015-04-13 15:28:12 +02:00
parent 7c94ce910f
commit 50ab994ab3
2 changed files with 9 additions and 0 deletions

View File

@@ -3156,6 +3156,7 @@ post2nfa(postfix, end, nfa_calc_size)
if (stackp < stack) \ if (stackp < stack) \
{ \ { \
st_error(postfix, end, p); \ st_error(postfix, end, p); \
vim_free(stack); \
return NULL; \ return NULL; \
} }
@@ -3632,10 +3633,16 @@ post2nfa(postfix, end, nfa_calc_size)
e = POP(); e = POP();
if (stackp != stack) if (stackp != stack)
{
vim_free(stack);
EMSG_RET_NULL(_("E875: (NFA regexp) (While converting from postfix to NFA), too many states left on stack")); EMSG_RET_NULL(_("E875: (NFA regexp) (While converting from postfix to NFA), too many states left on stack"));
}
if (istate >= nstate) if (istate >= nstate)
{
vim_free(stack);
EMSG_RET_NULL(_("E876: (NFA regexp) Not enough space to store the whole NFA ")); EMSG_RET_NULL(_("E876: (NFA regexp) Not enough space to store the whole NFA "));
}
matchstate = &state_ptr[istate++]; /* the match state */ matchstate = &state_ptr[istate++]; /* the match state */
matchstate->c = NFA_MATCH; matchstate->c = NFA_MATCH;

View File

@@ -741,6 +741,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
696,
/**/ /**/
695, 695,
/**/ /**/