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

Re: PATCH: Fix leak during Y shortcircuit glob qualifier



On Thu, Sep 24, 2015 at 5:12 AM, Bart Schaefer
<schaefer@xxxxxxxxxxxxxxxx> wrote:
> On Sep 23, 11:54pm, Mikael Magnusson wrote:
> } Subject: PATCH: Fix leak during Y shortcircuit glob qualifier
> }
> } The closedir(lock) is the leak I actually did see in usage, I have no
> } idea if the other part is needed/harmful though. I'll commit just the
> } closedir if nobody has any opinions.
>
> Since scanner() is being called recursively, it's not clear that the
> recursive call won't have already done an equivalent restoredir()
> in the first two "return" cases -- but I do suspect it's needed in
> the case where the closedir(lock) plugs a leak.
>
> Is the current directory munged in the situation where you found a leak?

Oops, I see that I forgot to include the actual test case in the
message. I think I had it typed out in gmail and then decided to look
into the code instead and forgot to put it in the git send-email.

% : ./*(-.Y1N); ls -l /proc/$$/fd

was my test case, so not much would happen to $PWD in that particular
case. I tried */*/*(-.Y5N) instead now, and nothing untoward seemed to
happen then either (without and with my patch, so no weird pwd
changing or errors about double frees, respectively).

-- 
Mikael Magnusson



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