From 4b2a17e4e309935e680c6ee3200e457b9b975eca Mon Sep 17 00:00:00 2001 From: Andrew Steurer <94206073+asteurer@users.noreply.github.com> Date: Fri, 15 May 2026 14:24:01 -0500 Subject: [PATCH] fix: add defer pinner.Unpin() Signed-off-by: Andrew Steurer <94206073+asteurer@users.noreply.github.com> --- crates/go/src/lib.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/crates/go/src/lib.rs b/crates/go/src/lib.rs index bf754f81b..4caf53a04 100644 --- a/crates/go/src/lib.rs +++ b/crates/go/src/lib.rs @@ -1326,7 +1326,10 @@ func {camel}({go_params}) {go_results} {{ ( if abi::guest_export_needs_post_return(resolve, func) { - format!("{PINNER} := &runtime.Pinner{{}}") + format!( + "{PINNER} := &runtime.Pinner{{}} + defer {PINNER}.Unpin()" + ) } else { String::new() },