From: "Bart Schaefer" <schaefer@brasslantern.com>
To: Peter Stephenson <pws@ibmth.df.unipi.it>, zsh-workers@math.gatech.edu
Subject: Re: PATCH: zsh-3.1.5-pws-4 + typeset fix: memory leak
Date: Fri, 15 Jan 1999 08:43:15 -0800 [thread overview]
Message-ID: <990115084316.ZM26658@candle.brasslantern.com> (raw)
In-Reply-To: <9901151544.AA14645@ibmth.df.unipi.it>
On Jan 15, 4:44pm, Peter Stephenson wrote:
} Subject: PATCH: zsh-3.1.5-pws-4 + typeset fix: memory leak
}
} the problem with your approach is that `print -P' can take more than
} one argument, and all need freeing: the easiest thing to do is use
} heap memory (which gets freed automatically when the builtin exits),
} and free the permanent memory straight away.
Another place where 3.0.5 appears to have been patched but 3.1.5 has not.
The 3.0.5 code reads:
/* -P option -- interpret as a prompt sequence */
if(ops['P']) {
char *arg = putprompt(metafy(args[n], len[n], META_NOALLOC),
&len[n], NULL, 0);
args[n] = (char *)alloc(len[n] + 1);
memcpy(args[n], arg, len[n]);
args[n][len[n]] = 0;
free(arg);
}
I'm sure the memcpy() is done to avoid recomputing len[n]+1 in dupstring().
--
Bart Schaefer Brass Lantern Enterprises
http://www.well.com/user/barts http://www.brasslantern.com
prev parent reply other threads:[~1999-01-15 16:48 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
1999-01-15 2:17 Question: patch for " Daniel X. Pape
1999-01-15 15:20 ` PATCH: was " Daniel X. Pape
1999-01-15 15:44 ` PATCH: zsh-3.1.5-pws-4 + typeset fix: " Peter Stephenson
1999-01-15 16:43 ` Bart Schaefer [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=990115084316.ZM26658@candle.brasslantern.com \
--to=schaefer@brasslantern.com \
--cc=pws@ibmth.df.unipi.it \
--cc=zsh-workers@math.gatech.edu \
/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).