1
0
forked from aniani/vim

updated for version 7.3.073

Problem:    Double free memory when netbeans command follows DETACH.
Solution:   Only free the node when owned. (Xavier de Gaye)
This commit is contained in:
Bram Moolenaar
2010-12-02 17:09:54 +01:00
parent 94950a9ee0
commit 863053d1d4
2 changed files with 10 additions and 2 deletions

View File

@@ -643,6 +643,7 @@ netbeans_parse_messages(void)
{ {
char_u *p; char_u *p;
queue_T *node; queue_T *node;
int own_node;
while (head.next != NULL && head.next != &head) while (head.next != NULL && head.next != &head)
{ {
@@ -681,20 +682,25 @@ netbeans_parse_messages(void)
*p++ = NUL; *p++ = NUL;
if (*p == NUL) if (*p == NUL)
{ {
own_node = TRUE;
head.next = node->next; head.next = node->next;
node->next->prev = node->prev; node->next->prev = node->prev;
} }
else
own_node = FALSE;
/* now, parse and execute the commands */ /* now, parse and execute the commands */
nb_parse_cmd(node->buffer); nb_parse_cmd(node->buffer);
if (*p == NUL) if (own_node)
{ {
/* buffer finished, dispose of the node and buffer */ /* buffer finished, dispose of the node and buffer */
vim_free(node->buffer); vim_free(node->buffer);
vim_free(node); 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 */ /* more follows, move to the start */
STRMOVE(node->buffer, p); STRMOVE(node->buffer, p);

View File

@@ -714,6 +714,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 */
/**/
73,
/**/ /**/
72, 72,
/**/ /**/