Skip to content

Commit aaa44bf

Browse files
brammooldouglaskayama
authored andcommitted
patch 7.4.696 Problem: Not freeing memory when encountering an error. Solution: Free the stack before returning. (Eliseo Martínez)
1 parent 4ac7802 commit aaa44bf

2 files changed

Lines changed: 9 additions & 0 deletions

File tree

src/regexp_nfa.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3156,6 +3156,7 @@ post2nfa(postfix, end, nfa_calc_size)
31563156
if (stackp < stack) \
31573157
{ \
31583158
st_error(postfix, end, p); \
3159+
vim_free(stack); \
31593160
return NULL; \
31603161
}
31613162

@@ -3632,10 +3633,16 @@ post2nfa(postfix, end, nfa_calc_size)
36323633

36333634
e = POP();
36343635
if (stackp != stack)
3636+
{
3637+
vim_free(stack);
36353638
EMSG_RET_NULL(_("E875: (NFA regexp) (While converting from postfix to NFA), too many states left on stack"));
3639+
}
36363640

36373641
if (istate >= nstate)
3642+
{
3643+
vim_free(stack);
36383644
EMSG_RET_NULL(_("E876: (NFA regexp) Not enough space to store the whole NFA "));
3645+
}
36393646

36403647
matchstate = &state_ptr[istate++]; /* the match state */
36413648
matchstate->c = NFA_MATCH;

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -756,6 +756,8 @@ static char *(features[]) =
756756

757757
static int included_patches[] =
758758
{ /* Add new patch number below this line */
759+
/**/
760+
696,
759761
/**/
760762
695,
761763
/**/

0 commit comments

Comments
 (0)