From: Bart Schaefer <schaefer@brasslantern.com>
To: zsh-workers@zsh.org (Zsh hackers list)
Subject: Re: PATCH: memory leak in anonoymous functions
Date: Fri, 03 Dec 2010 15:49:00 -0800 [thread overview]
Message-ID: <101203154900.ZM4171@torch.brasslantern.com> (raw)
In-Reply-To: <13070.1291418408@pws-pc.ntlworld.com>
On Dec 3, 11:20pm, Peter Stephenson wrote:
}
} save = (!(state->prog->flags & EF_HEAP) &&
} !strcmp(opat, right) && pprog != dummy_patprog2);
}
} if (!(pprog = patcompile(right, (save ? PAT_ZDUP : PAT_STATIC),
} NULL))) {
} zwarnnam(fromtest, "bad pattern: %s", right);
} return 2;
} }
} else if (save)
} state->prog->pats[npat] = pprog;
}
} That pprog might be leaked, it says. Er, yeah, right.
Well, if save is false but patcompile() returns non-null, then pprog
is never assigned anywhere. But if save is false then patcompile() was
called with PAT_STATIC and there's nothing to free. It's not very
surprising that a compile-time analysis wouldn't figure that out, but
valgrind does runtime analysis ...
Which would mean that state->prog->pats[] is what's being leaked ...,
sometime after evalcond() returns?
prev parent reply other threads:[~2010-12-03 23:49 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-12-03 23:20 Peter Stephenson
2010-12-03 23:49 ` 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=101203154900.ZM4171@torch.brasslantern.com \
--to=schaefer@brasslantern.com \
--cc=zsh-workers@zsh.org \
/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).