zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <pws@csr.com>
To: zsh-workers@sunsite.dk
Subject: Re: Memory leaks found by valgrind
Date: Wed, 05 Mar 2003 13:59:40 +0000	[thread overview]
Message-ID: <1856.1046872780@csr.com> (raw)
In-Reply-To: "Felix Rosencrantz"'s message of "Fri, 28 Feb 2003 14:07:22 PST." <20030228220722.16160.qmail@web10406.mail.yahoo.com>

Felix Rosencrantz wrote:
> The only new leak I found was the following.   This I believe is related
> to replace-string command.  When I tried that widget, I would get more
> leaks.  (I haven't tried using other recent features/changes.)
>  62 bytes in 62 blocks are definitely lost in loss record 5 of 13
>     at 0x40165A60: malloc (vg_clientfuncs.c:100)
>     by 0x8086275: zalloc (mem.c:490)
>     by 0x810536C: set_prepost (zle_params.c:485)
>     by 0x810541E: set_postdisplay (zle_params.c:515)
>     by 0x808F7F4: setstrvalue (params.c:1608)
>     by 0x8090BAC: assignsparam (params.c:1994)
>     by 0x805F0A6: addvars (exec.c:1598)
>     by 0x805CDC9: execsimple (exec.c:756)

This could be the following, which needs patching anyway.

Index: Src/Zle/zle_params.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Zle/zle_params.c,v
retrieving revision 1.8
diff -u -r1.8 zle_params.c
--- Src/Zle/zle_params.c	27 Jan 2003 14:55:02 -0000	1.8
+++ Src/Zle/zle_params.c	5 Mar 2003 13:58:09 -0000
@@ -482,8 +482,10 @@
     }
     if (x) {
 	unmetafy(x, lenvar);
-	*textvar = (unsigned char *)zalloc(*lenvar);
-	memcpy((char *)*textvar, x, *lenvar);
+	if (*lenvar) {
+	    *textvar = (unsigned char *)zalloc(*lenvar);
+	    memcpy((char *)*textvar, x, *lenvar);
+	}
 	free(x);
     }
 }

-- 
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.
**********************************************************************


      reply	other threads:[~2003-03-05 14:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-02-08 18:03 Felix Rosencrantz
2003-02-17  9:44 ` Memory leaks found by valgrind (try2) Felix Rosencrantz
2003-02-17 10:39 ` Memory leaks found by valgrind Peter Stephenson
2003-02-28 22:07   ` Felix Rosencrantz
2003-03-05 13:59     ` Peter Stephenson [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1856.1046872780@csr.com \
    --to=pws@csr.com \
    --cc=zsh-workers@sunsite.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).