Skip to content
This repository has been archived by the owner on Feb 9, 2024. It is now read-only.

Commit

Permalink
Move dealloc
Browse files Browse the repository at this point in the history
  • Loading branch information
blinktag committed Nov 20, 2023
1 parent 98f09a4 commit 82463bf
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions function.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,17 +62,17 @@ 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 {
return nil, errors.Wrap(err, "unable to read 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")
}

return resBytes, nil
}

Expand Down

0 comments on commit 82463bf

Please sign in to comment.