I like what you & Robin sketch. FWIW, it's hard for me to get excited
over the issue of leaks-in-the-face-of-error-recovery. Presumably it would
take in practice a lot of error recovery before this actually hoses the
execution due to running out of memory. At that point, it's not unreasonable
for things to keel over anyway.
An alternative/additional approach would be to introduce a notion of
"failure" as a first-class object. In another life I used a language that
did that, and it worked remarkably well. But clearly that's a bigger
undertaking than the valuable near-term notion of regularizing how Zeek
deals with errors.