From ae6471f1c94f51df540d95edc09c7749002f44e8 Mon Sep 17 00:00:00 2001 From: Peter Mikkelsen Date: Tue, 22 Feb 2022 20:41:56 +0000 Subject: Implement some form of error guards. It may not be perfect yet --- memory.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'memory.c') diff --git a/memory.c b/memory.c index 533e159..806d5df 100644 --- a/memory.c +++ b/memory.c @@ -271,4 +271,23 @@ dupoperator(Operator o) threadexitsall("dupoperator"); } return p; +} + +void +freeerrorguards(ErrorGuard *e) +{ + ErrorGuard *next; + while(e != nil){ + next = e->next; + freeerrorguard(e); + e = next; + } +} + +void +freeerrorguard(ErrorGuard *e) +{ + if(e->active) + freedfnframe(e->frame, 1); /* otherwise the frame is on the dfn stack and will be free'd that way */ + free(e); } \ No newline at end of file -- cgit v1.2.3