On Mon, Jun 3, 2024 at 3:53 PM Chet Ramey <chet.ra...@case.edu> wrote: > > On 5/31/24 5:07 PM, Grisha Levit wrote: > > Two minor leak fixes for conditional command error conditions: > > > > If a WORD token is read when COND_AND, COND_OR, COND_END, or a binary > > operator are expected, the allocated WORD_DESC is leaked. > > > > If a conditional command has a syntax error, the allocated COMMAND is > leaked. > > Thanks for the report. These are interactive errors only, since a syntax > error in a compound command causes the shell to exit.
And also syntax errors in `eval' and `.' input when not in POSIX mode. But I agree this kind of fix may not be terribly useful. My goal was to try to get LeakSanitizer results down to a more manageable level, so as to surface interesting leaks more easily, though I'm not sure how far I can really get. I can certainly see the argument for not adding code (and associated runtime overhead for the non-error path) that deals only with avoiding leaks in cases like these. LMK if you don't think changes like this are worthwhile.