Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: valgrind: useful memory checker



Felix Rosencrantz wrote:

> ...
> 
> Also, I ran valgrind on zsh interactively for a little bit, did
> some completions and found a couple leaks.  Of course, adding valgrind
> to the automated tests would be quite useful.
> 
> -FR.
> ==3725== 80 bytes in 1 blocks are definitely lost in loss record 45 of 136
> ==3725==    at 0x808C516: zalloc (in /bin/linux/zsh-020416d/bin/zsh)
> ==3725==    by 0x80A3010: patcompile (in /bin/linux/zsh-020416d/bin/zsh)
> ==3725==    by 0x413C4011: bin_zstyle (in
> /bin/linux/zsh-020416d/lib/zsh/4.1.0-dev-4-020416/zsh/zutil.so)
> ==3725==    by 0x8052425: execbuiltin (in /bin/linux/zsh-020416d/bin/zsh)
> ==3725==    by 0x8067E93: execcmd (in /bin/linux/zsh-020416d/bin/zsh)
> ==3725==    by 0x806484B: execpline2 (in /bin/linux/zsh-020416d/bin/zsh)
> ==3725==    by 0x8063DDF: execpline (in /bin/linux/zsh-020416d/bin/zsh)
> ==3725==    by 0x80637D3: execlist (in /bin/linux/zsh-020416d/bin/zsh)

Do you set the same style for the same pattern twice?

> ==3725== 132 bytes in 33 blocks are definitely lost in loss record 62 of 136
> ==3725==    at 0x808C516: zalloc (in /bin/linux/zsh-020416d/bin/zsh)
> ==3725==    by 0x80B9DE2: zarrdup (in /bin/linux/zsh-020416d/bin/zsh)
> ==3725==    by 0x411EC6D4: comp_wrapper (in
> /bin/linux/zsh-020416d/lib/zsh/4.1.0-dev-4-020416/zsh/complete.so)
> ==3725==    by 0x806AB53: runshfunc (in /bin/linux/zsh-020416d/bin/zsh)
> ==3725==    by 0x806A973: doshfunc (in /bin/linux/zsh-020416d/bin/zsh)
> ==3725==    by 0x806A33C: execshfunc (in /bin/linux/zsh-020416d/bin/zsh)
> ==3725==    by 0x8067E09: execcmd (in /bin/linux/zsh-020416d/bin/zsh)
> ==3725==    by 0x806484B: execpline2 (in /bin/linux/zsh-020416d/bin/zsh)
> ==3725== 

These are 33 times a char ** to a NULL pointer. The copied compredirs
array.


Bye
  Sven

Index: Src/Modules/zutil.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Modules/zutil.c,v
retrieving revision 1.9
diff -u -r1.9 zutil.c
--- Src/Modules/zutil.c	9 Jul 2001 16:05:14 -0000	1.9
+++ Src/Modules/zutil.c	24 Apr 2002 07:56:12 -0000
@@ -132,6 +132,7 @@
 		freearray(p->vals);
 	    if (p->eval)
 		freeeprog(p->eval);
+            freepatprog(p->prog);
 	    p->vals = zarrdup(vals);
 	    p->eval = eprog;
 
Index: Src/Zle/complete.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Zle/complete.c,v
retrieving revision 1.20
diff -u -r1.20 complete.c
--- Src/Zle/complete.c	1 Mar 2002 10:42:02 -0000	1.20
+++ Src/Zle/complete.c	24 Apr 2002 07:56:12 -0000
@@ -1320,6 +1320,7 @@
 	    zsfree(oqs);
 	    zsfree(oaq);
 	    freearray(owords);
+	    freearray(oredirs);
 	}
 	zsfree(comprestore);
 	comprestore = orest;

-- 
Sven Wischnowsky                          wischnow@xxxxxxxxx



Messages sorted by: Reverse Date, Date, Thread, Author