zsh-workers
 help / color / mirror / code / Atom feed
* More memory problems found by valgrind
@ 2002-08-08  5:27 Felix Rosencrantz
  2002-08-08 10:15 ` Peter Stephenson
  2002-08-08 10:27 ` Peter Stephenson
  0 siblings, 2 replies; 3+ messages in thread
From: Felix Rosencrantz @ 2002-08-08  5:27 UTC (permalink / raw)
  To: zsh-workers

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)

240 bytes in 5 blocks are definitely lost in loss record 6 of 19
   at 0x400467C4: malloc (vg_clientfuncs.c:100)
   by 0x808C606: zalloc (mem.c:490)
   by 0x80ABCA9: ztrdup (string.c:52)
   by 0x8080734: setjobpwd (jobs.c:1032)

258 bytes in 1 blocks are possibly lost in loss record 6 of 17
   at 0x400467C4: malloc (vg_clientfuncs.c:100)
   by 0x808C606: zalloc (mem.c:490)
   by 0x411C59A2: zleread (zle_main.c:760)
   by 0x411C70ED: bin_vared (zle_main.c:1121)

258 bytes in 1 blocks are possibly lost in loss record 6 of 18
   at 0x400467C4: malloc (vg_clientfuncs.c:100)
   by 0x808C606: zalloc (mem.c:490)
   by 0x411C59A2: zleread (zle_main.c:760)
   by 0x411C70ED: bin_vared (zle_main.c:1121)

Conditional jump or move depends on uninitialised value(s)
   at 0x411C8953: killline (zle_misc.c:297)
   by 0x411C5EBE: execzlefunc (zle_main.c:862)
   by 0x411C55DA: zlecore (zle_main.c:660)
   by 0x411C5B7F: zleread (zle_main.c:796)

Invalid read of size 1
   at 0x40246813: histwgetfn (parameter.c:1116)
   by 0x80929F9: getvaluearr (params.c:451)
   by 0x8095A3B: getarrvalue (params.c:1500)
   by 0x80AFF3B: paramsubst (subst.c:1261)
   Address 0x4109D0F4 is 0 bytes after a block of size 48 alloc'd
   at 0x400467C4: malloc (vg_clientfuncs.c:100)
   by 0x808C606: zalloc (mem.c:490)
   by 0x80ABCA9: ztrdup (string.c:52)
   by 0x80775A3: hend (hist.c:1145)
Invalid write of size 1
   at 0x40246818: histwgetfn (parameter.c:1117)
   by 0x80929F9: getvaluearr (params.c:451)
   by 0x8095A3B: getarrvalue (params.c:1500)
   by 0x80AFF3B: paramsubst (subst.c:1261)
   Address 0x4109D0F4 is 0 bytes after a block of size 48 alloc'd
   at 0x400467C4: malloc (vg_clientfuncs.c:100)
   by 0x808C606: zalloc (mem.c:490)
   by 0x80ABCA9: ztrdup (string.c:52)
   by 0x80775A3: hend (hist.c:1145)
Invalid write of size 1
   at 0x40246846: histwgetfn (parameter.c:1119)
   by 0x80929F9: getvaluearr (params.c:451)
   by 0x8095A3B: getarrvalue (params.c:1500)
   by 0x80AFF3B: paramsubst (subst.c:1261)
   Address 0x4109D0F4 is 0 bytes after a block of size 48 alloc'd
   at 0x400467C4: malloc (vg_clientfuncs.c:100)
   by 0x808C606: zalloc (mem.c:490)
   by 0x80ABCA9: ztrdup (string.c:52)
   by 0x80775A3: hend (hist.c:1145)

116 bytes in 1 blocks are possibly lost in loss record 5 of 20
   at 0x400467C4: malloc (vg_clientfuncs.c:100)
   by 0x808C786: zcalloc (mem.c:508)
   by 0x807FE61: addproc (jobs.c:832)
   by 0x8066F59: execcmd (exec.c:2029)




__________________________________________________
Do You Yahoo!?
HotJobs - Search Thousands of New Jobs
http://www.hotjobs.com


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: More memory problems found by valgrind
  2002-08-08  5:27 More memory problems found by valgrind Felix Rosencrantz
@ 2002-08-08 10:15 ` Peter Stephenson
  2002-08-08 10:27 ` Peter Stephenson
  1 sibling, 0 replies; 3+ messages in thread
From: Peter Stephenson @ 2002-08-08 10:15 UTC (permalink / raw)
  To: Zsh hackers list

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@csr.com>                  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.
**********************************************************************


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: More memory problems found by valgrind
  2002-08-08  5:27 More memory problems found by valgrind Felix Rosencrantz
  2002-08-08 10:15 ` Peter Stephenson
@ 2002-08-08 10:27 ` Peter Stephenson
  1 sibling, 0 replies; 3+ messages in thread
From: Peter Stephenson @ 2002-08-08 10:27 UTC (permalink / raw)
  To: zsh-workers

Felix Rosencrantz wrote:
> 240 bytes in 5 blocks are definitely lost in loss record 6 of 19
>    at 0x400467C4: malloc (vg_clientfuncs.c:100)
>    by 0x808C606: zalloc (mem.c:490)
>    by 0x80ABCA9: ztrdup (string.c:52)
>    by 0x8080734: setjobpwd (jobs.c:1032)

It's less obvious why there should be a leak --- except for going into a
subshell where there certainly is --- but the following fixes up the two
anomalies I can see with job->pwd.

That's all for the time being.

Index: Src/jobs.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/jobs.c,v
retrieving revision 1.16
diff -u -r1.16 jobs.c
--- Src/jobs.c	5 Jun 2002 14:57:08 -0000	1.16
+++ Src/jobs.c	8 Aug 2002 10:24:52 -0000
@@ -979,6 +979,10 @@
 	    zfree(jobtab[i].ty, sizeof(struct ttyinfo));
 	    jobtab[i].ty = NULL;
 	}
+	if (jobtab[i].pwd) {
+	    zsfree(jobtab[i].pwd);
+	    jobtab[i].pwd = NULL;
+	}
 	if (monitor) {
 	    /*
 	     * See if there is a jobtable worth saving.
@@ -1011,8 +1015,10 @@
     for (i = 1; i < MAXJOB; i++)
 	if (!jobtab[i].stat) {
 	    jobtab[i].stat = STAT_INUSE;
-	    if (jobtab[i].pwd)
+	    if (jobtab[i].pwd) {
 		zsfree(jobtab[i].pwd);
+		jobtab[i].pwd = NULL;
+	    }
 	    jobtab[i].gleader = 0;
 	    return i;
 	}

-- 
Peter Stephenson <pws@csr.com>                  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.
**********************************************************************


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2002-08-08 10:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-08-08  5:27 More memory problems found by valgrind Felix Rosencrantz
2002-08-08 10:15 ` Peter Stephenson
2002-08-08 10:27 ` Peter Stephenson

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).