Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Feature request: ZSH_XTRACEFD variable

On Wed, 2019-07-31 at 21:40 +0200, Timothée Mazzucotelli wrote:
> About leaks, I think file pointers are all freed in the params.c set
> and unset functions.  However I'm not sure about exec.c, line 5396, in
> function execshfunc, where xtrerr was previously always reassigned to
> stderr. Now it is reassigned to a new file pointer obtained with
> fdopen(zsh_xtracefd, "w") each time, and maybe this could cause memory
> leaks.

Only just had a chance to look at this but yes, I think this is a
problem.  I'm not really sure why this assignment is needed, but if it
is it should reassign to a previously opened file.  Possibly the right
thing to do is to keep a separate FILE *xtrace_file which always points
to the file opened in xracefdsetfn or stderr if none (so no file
management is ever done directly on this, it's simply a pointer to the
FILE opened to the last trace file requested by the user or stderr if


Messages sorted by: Reverse Date, Date, Thread, Author