]> granicus.if.org Git - vim/commitdiff
patch 7.4.696 v7.4.696
authorBram Moolenaar <Bram@vim.org>
Mon, 13 Apr 2015 13:28:12 +0000 (15:28 +0200)
committerBram Moolenaar <Bram@vim.org>
Mon, 13 Apr 2015 13:28:12 +0000 (15:28 +0200)
Problem:    Not freeing memory when encountering an error.
Solution:   Free the stack before returning. (Eliseo Martínez)

src/regexp_nfa.c
src/version.c

index e67f6380c13df8fdd00e6842aa2b99531b51c39b..825f960ca742f8c8fe71e248cdbe9bf5cc80b15a 100644 (file)
@@ -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;
index 4cbf4b6ae3f4b6215c810550dd436ed84b8c8149..21261e4d2cefe0605ed70cfec8588a011aa9bb9d 100644 (file)
@@ -741,6 +741,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    696,
 /**/
     695,
 /**/