From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4721 invoked by alias); 3 Dec 2010 23:49:29 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 28470 Received: (qmail 20905 invoked from network); 3 Dec 2010 23:49:27 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received-SPF: none (ns1.primenet.com.au: domain at closedmail.com does not designate permitted sender hosts) From: Bart Schaefer Message-id: <101203154900.ZM4171@torch.brasslantern.com> Date: Fri, 03 Dec 2010 15:49:00 -0800 In-reply-to: <13070.1291418408@pws-pc.ntlworld.com> Comments: In reply to Peter Stephenson "PATCH: memory leak in anonoymous functions" (Dec 3, 11:20pm) References: <13070.1291418408@pws-pc.ntlworld.com> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: zsh-workers@zsh.org (Zsh hackers list) Subject: Re: PATCH: memory leak in anonoymous functions MIME-version: 1.0 Content-type: text/plain; charset=us-ascii 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?