]> granicus.if.org Git - vim/commitdiff
updated for version 7.3.073 v7.3.073
authorBram Moolenaar <Bram@vim.org>
Thu, 2 Dec 2010 16:09:54 +0000 (17:09 +0100)
committerBram Moolenaar <Bram@vim.org>
Thu, 2 Dec 2010 16:09:54 +0000 (17:09 +0100)
Problem:    Double free memory when netbeans command follows DETACH.
Solution:   Only free the node when owned. (Xavier de Gaye)

src/netbeans.c
src/version.c

index 7ba8d8dc214d6b2b08a1892bfc72f10661287bd1..3134db9d238262bc2bba9f0feba5b08c8ce158b1 100644 (file)
@@ -643,6 +643,7 @@ netbeans_parse_messages(void)
 {
     char_u     *p;
     queue_T    *node;
+    int                own_node;
 
     while (head.next != NULL && head.next != &head)
     {
@@ -681,20 +682,25 @@ netbeans_parse_messages(void)
            *p++ = NUL;
            if (*p == NUL)
            {
+               own_node = TRUE;
                head.next = node->next;
                node->next->prev = node->prev;
            }
+           else
+               own_node = FALSE;
 
            /* now, parse and execute the commands */
            nb_parse_cmd(node->buffer);
 
-           if (*p == NUL)
+           if (own_node)
            {
                /* buffer finished, dispose of the node and buffer */
                vim_free(node->buffer);
                vim_free(node);
            }
-           else
+           /* Check that "head" wasn't changed under our fingers, e.g. when a
+            * DETACH command was handled. */
+           else if (head.next == node)
            {
                /* more follows, move to the start */
                STRMOVE(node->buffer, p);
index 85128805fd5490a00b1d14b5f69aa3f8a6b07869..9d414e80301bdbbb1a878e7ad9b5c761a2d3428f 100644 (file)
@@ -714,6 +714,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    73,
 /**/
     72,
 /**/