From e94e4b62b712e4095628a8b8fb21f04d0a124d27 Mon Sep 17 00:00:00 2001 From: vbot Date: Wed, 8 Jan 2025 13:57:45 +0100 Subject: [PATCH] Fix C runtime memory leak --- runtimes/c/runtime.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/runtimes/c/runtime.c b/runtimes/c/runtime.c index 236d9cc93..2449afb82 100644 --- a/runtimes/c/runtime.c +++ b/runtimes/c/runtime.c @@ -97,9 +97,12 @@ void* catala_malloc (size_t sz) void catala_free_all() { + struct catala_heap * next_ptr; while (catala_heap.mem != NULL) { free(catala_heap.mem); + next_ptr = catala_heap.next; catala_heap = *catala_heap.next; + free(next_ptr); } }