Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: More memory problems found by valgrind
- X-seq: zsh-workers 17517
- From: Peter Stephenson <pws@xxxxxxx>
- To: zsh-workers@xxxxxxxxxxxxxx
- Subject: Re: More memory problems found by valgrind
- Date: Thu, 08 Aug 2002 11:27:02 +0100
- In-reply-to: "Felix Rosencrantz"'s message of "Wed, 07 Aug 2002 22:27:22 PDT." <20020808052722.15964.qmail@xxxxxxxxxxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
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@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