From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 319 invoked from network); 8 Aug 2002 10:27:39 -0000 Received: from sunsite.dk (130.225.247.90) by ns1.primenet.com.au with SMTP; 8 Aug 2002 10:27:39 -0000 Received: (qmail 1685 invoked by alias); 8 Aug 2002 10:27:32 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 17517 Received: (qmail 1669 invoked from network); 8 Aug 2002 10:27:31 -0000 To: zsh-workers@sunsite.auc.dk Subject: Re: More memory problems found by valgrind In-reply-to: "Felix Rosencrantz"'s message of "Wed, 07 Aug 2002 22:27:22 PDT." <20020808052722.15964.qmail@web10403.mail.yahoo.com> Date: Thu, 08 Aug 2002 11:27:02 +0100 Message-ID: <12925.1028802422@csr.com> From: Peter Stephenson 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 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. **********************************************************************