From 84b5f0c91e62b072f8353e0e7a3e95e362038dce Mon Sep 17 00:00:00 2001 From: Folkert Date: Thu, 26 Aug 2021 23:28:11 +0200 Subject: [PATCH] free allocated buffer --- examples/cli/platform/src/lib.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/examples/cli/platform/src/lib.rs b/examples/cli/platform/src/lib.rs index 16ba97add8..152ac7e97b 100644 --- a/examples/cli/platform/src/lib.rs +++ b/examples/cli/platform/src/lib.rs @@ -112,7 +112,10 @@ unsafe fn call_the_closure(closure_data_ptr: *const u8) -> i64 { let output = &*(buffer as *mut RocCallResult<()>); match output.into() { - Ok(_) => 0, + Ok(_) => { + std::alloc::dealloc(buffer, layout); + 0 + } Err(e) => panic!("failed with {}", e), } }