On 24-Aug-2010 Lech Lorens <[email protected]> wrote:
> On 24-Aug-2010 Christian Brabandt <[email protected]> wrote:
> > Hi,
> > I have been playing with the undotree() function lately. Unfortunately, 
> > it didn't take long, until it crashed :(
> > 
> > Here is a way to reproduce it:
> > 
> > chrisbra t41:~/vim [1016]% vim -u NONE -N -c ':echo undotree().entries'
> > Vim: Caught deadly signal ABRT
> > 
> > Vim: Finished.
> > zsh: abort      vim -u NONE -N
> 
> This happens due to a double free(). The attached patch fixes the
> problem. I'll prepare a test for this.

I ran the tests with Valgrind after applying the previous patch.
Everything seems to be in order.

The attached patch contains the modification to eval.c, updated test61
and a modification to testdir/Makefile which makes it remove the output
generated by Valgrind when "make clean" is performed.

-- 
Cheers,
Lech

-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
diff --git a/src/eval.c b/src/eval.c
index fc01006..3e874b0 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -7097,6 +7097,7 @@ dict_add_list(d, key, list)
 	dictitem_free(item);
 	return FAIL;
     }
+    ++list->lv_refcount;
     return OK;
 }
 
diff --git a/src/testdir/Makefile b/src/testdir/Makefile
index 4951dc2..bdc2c28 100644
--- a/src/testdir/Makefile
+++ b/src/testdir/Makefile
@@ -44,7 +44,7 @@ report:
 $(SCRIPTS) $(SCRIPTS_GUI): $(VIMPROG)
 
 clean:
-	-rm -rf *.out *.failed *.rej *.orig test.log tiny.vim small.vim mbyte.vim mzscheme.vim test.ok X* valgrind.pid* viminfo
+	-rm -rf *.out *.failed *.rej *.orig test.log tiny.vim small.vim mbyte.vim mzscheme.vim test.ok X* valgrind.* viminfo
 
 test1.out: test1.in
 	-rm -f $*.failed tiny.vim small.vim mbyte.vim mzscheme.vim test.ok X* viminfo
diff --git a/src/testdir/test61.in b/src/testdir/test61.in
index f9a1574..8883163 100644
--- a/src/testdir/test61.in
+++ b/src/testdir/test61.in
@@ -4,6 +4,10 @@ undo-able pieces.  Do that by setting 'undolevels'.
 Also tests :earlier and :later.
 
 STARTTEST
+:echo undotree().entries
+ENDTEST
+
+STARTTEST
 :" Delete three characters and undo
 Gx:set ul=100
 x:set ul=100

Raspunde prin e-mail lui