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

Re: More memory problems found by valgrind



Felix Rosencrantz wrote:
> I ran zsh (pulled from cvs on July 30th) under valgrind for about a week.
> Below is a condensed version of the output from that run.
> 
> -FR.
> 
> 
> 80 bytes in 1 blocks are definitely lost in loss record 4 of 17
>    at 0x400467C4: malloc (vg_clientfuncs.c:100)
>    by 0x808C606: zalloc (mem.c:490)
>    by 0x80A3190: patcompile (pattern.c:436)
>    by 0x4428DFD1: bin_zstyle (zutil.c:292)

Let's try and pick these off one by one... Here's my guess for this one.

Index: Src/Modules/zutil.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Modules/zutil.c,v
retrieving revision 1.11
diff -u -r1.11 zutil.c
--- Src/Modules/zutil.c	25 Apr 2002 07:33:36 -0000	1.11
+++ Src/Modules/zutil.c	8 Aug 2002 10:15:01 -0000
@@ -119,7 +119,10 @@
 	errflag = ef;
 
 	if (!eprog)
+	{
+	    freepatprog(prog);
 	    return 1;
+	}
 
 	eprog = dupeprog(eprog, 0);
     }
@@ -134,6 +137,7 @@
 		freeeprog(p->eval);
 	    p->vals = zarrdup(vals);
 	    p->eval = eprog;
+	    freepatprog(prog);
 
 	    return 0;
 	}

-- 
Peter Stephenson <pws@xxxxxxx>                  Software Engineer
CSR Ltd., Science Park, Milton Road,
Cambridge, CB4 0WH, UK                          Tel: +44 (0)1223 692070


**********************************************************************
The information transmitted is intended only for the person or
entity to which it is addressed and may contain confidential 
and/or privileged material. 
Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by 
persons or entities other than the intended recipient is 
prohibited.  
If you received this in error, please contact the sender and 
delete the material from any computer.
**********************************************************************



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