Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: PATCH: memory leak in anonoymous functions
- X-seq: zsh-workers 28470
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxx (Zsh hackers list)
- Subject: Re: PATCH: memory leak in anonoymous functions
- Date: Fri, 03 Dec 2010 15:49:00 -0800
- In-reply-to: <13070.1291418408@xxxxxxxxxxxxxxxxxxx>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <13070.1291418408@xxxxxxxxxxxxxxxxxxx>
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?
Messages sorted by:
Reverse Date,
Date,
Thread,
Author