Fixed a memory leak where the screen would not be freed when used with the debugger
diff --git a/common.c b/common.c
index 7f1875f..3507e0f 100644
--- a/common.c
+++ b/common.c
@@ -7,15 +7,18 @@
catch_t g_catch[MAX_CATCH_LEN];
unsigned g_catch_len;
-void throw_(const char *msg, const char *file, unsigned int line)
+void unwind()
{
- fprintf(stderr, "\033[31mException thrown:\033[33m %s:%d\033[0m %s\n", file, line, msg);
-
for (int i = g_catch_len - 1; i >= 0; i--)
{
g_catch[i].fn(g_catch[i].arg);
}
+}
+void throw_(const char *msg, const char *file, unsigned int line)
+{
+ fprintf(stderr, "\033[31mException thrown:\033[33m %s:%d\033[0m %s\n", file, line, msg);
+ unwind();
exit(1);
}