Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
fix: Do not close wazero module on error (#3758)
wazero takes care not to leak modules when `InstantiateModule` returns
an error.

This means that sqlc will call `result.Close` a second time if a non nil
module was returned, which causes a segfault.
  • Loading branch information
edman committed Dec 25, 2024
commit 5095abdde280d07a48b81b13318e12f87670da46
2 changes: 1 addition & 1 deletion internal/ext/wasm/wasm.go
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ func (r *Runner) Invoke(ctx context.Context, method string, args any, reply any,
}

result, err := runtimeAndCode.rt.InstantiateModule(ctx, runtimeAndCode.code, conf)
if result != nil {
if err == nil {
defer result.Close(ctx)
}
if cerr := checkError(err, stderr); cerr != nil {
Expand Down
Loading