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:
@@ -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;
|
||||||
|
@@ -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,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user