Skip to content

Commit

Permalink
Merge pull request #543 from CosmWasm/co/fix-errorWithMessage
Browse files Browse the repository at this point in the history
Fix `errorWithMessage`
  • Loading branch information
chipshort authored Jun 26, 2024
2 parents caa4c0f + a716026 commit 73b87c0
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion internal/api/lib.go
Original file line number Diff line number Diff line change
Expand Up @@ -796,11 +796,13 @@ func convertGasReport(report C.GasReport) types.GasReport {
/**** To error module ***/

func errorWithMessage(err error, b C.UnmanagedVector) error {
// we always destroy the unmanaged vector to avoid a memory leak
msg := copyAndDestroyUnmanagedVector(b)

// this checks for out of gas as a special case
if errno, ok := err.(syscall.Errno); ok && int(errno) == 2 {
return types.OutOfGasError{}
}
msg := copyAndDestroyUnmanagedVector(b)
if msg == nil {
return err
}
Expand Down

0 comments on commit 73b87c0

Please sign in to comment.