summaryrefslogtreecommitdiff
path: root/memory.c
diff options
context:
space:
mode:
authorPeter Mikkelsen <peter@pmikkelsen.com>2022-02-22 20:41:56 +0000
committerPeter Mikkelsen <peter@pmikkelsen.com>2022-02-22 20:41:56 +0000
commitae6471f1c94f51df540d95edc09c7749002f44e8 (patch)
treed810e349ef9926b256d73b0af5b2497a0d355555 /memory.c
parente8e6feeb95cdc3b81a2c17b5a342a3d0b170ccb4 (diff)
Implement some form of error guards. It may not be perfect yet
Diffstat (limited to 'memory.c')
-rw-r--r--memory.c19
1 files changed, 19 insertions, 0 deletions
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