mirror of
https://github.com/neovim/neovim.git
synced 2025-09-29 22:48:34 +00:00
coverity/13773: Resource leak: RI.
Problem : Resource leak @ 3324. Diagnostic : Real issue. Rationale : Stack is not being freed on error cases. Resolution : Free stack before invoking EMSG_RET_NULL.
This commit is contained in:
@@ -2887,6 +2887,7 @@ static nfa_state_T *post2nfa(int *postfix, int *end, int nfa_calc_size)
|
|||||||
if (stackp < stack) \
|
if (stackp < stack) \
|
||||||
{ \
|
{ \
|
||||||
st_error(postfix, end, p); \
|
st_error(postfix, end, p); \
|
||||||
|
free(stack); \
|
||||||
return NULL; \
|
return NULL; \
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3316,13 +3317,17 @@ static nfa_state_T *post2nfa(int *postfix, int *end, int nfa_calc_size)
|
|||||||
}
|
}
|
||||||
|
|
||||||
e = POP();
|
e = POP();
|
||||||
if (stackp != stack)
|
if (stackp != stack) {
|
||||||
EMSG_RET_NULL(_(
|
free(stack);
|
||||||
"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) {
|
||||||
EMSG_RET_NULL(_(
|
free(stack);
|
||||||
"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;
|
||||||
|
Reference in New Issue
Block a user