From 98f09a42c9a2d7e005680ff7a2aef35fbfdcded0 Mon Sep 17 00:00:00 2001 From: Mark G Date: Mon, 20 Nov 2023 09:29:53 -0500 Subject: [PATCH] Fix mem leak --- function.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/function.go b/function.go index 07b31fc..e557aed 100644 --- a/function.go +++ b/function.go @@ -62,6 +62,11 @@ func (f *function) Exec(ctx context.Context, req []byte) ([]byte, error) { return nil, errors.Wrap(err, "unable to deallocate memory") } + // Dealloc response memory + if _, err := f.dealloc.Call(ctx, uint64(resultPtr), uint64(resultSize)); err != nil { + return nil, errors.Wrap(err, "unable to deallocate memory") + } + // Read memory starting from result ptr resBytes, err := f.readMemory(resultPtr, resultSize) if err != nil {