Skip to content

Commit

Permalink
f
Browse files Browse the repository at this point in the history
  • Loading branch information
axic committed Apr 23, 2019
1 parent bbf5b1f commit 610f520
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 3 additions & 3 deletions bindings/rust/evmc-vm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -194,9 +194,9 @@ impl Into<ffi::evmc_result> for ExecutionResult {
gas_left: self.gas_left,
output_data: buffer,
output_size: len,
release: None,
//release: None,
// This still crashes.
// release: Some(release_stack_result),
release: Some(release_stack_result),
create_address: self.create_address,
padding: [0u8; 4],
}
Expand All @@ -207,7 +207,7 @@ impl Into<ffi::evmc_result> for ExecutionResult {
extern "C" fn release_stack_result(result: *const ffi::evmc_result) {
unsafe {
let tmp = *result;
if tmp.output_data.is_null() {
if !tmp.output_data.is_null() {
let buf_layout =
std::alloc::Layout::from_size_align(tmp.output_size, 1).expect("Bad layout");
std::alloc::dealloc(tmp.output_data as *mut u8, buf_layout);
Expand Down
2 changes: 2 additions & 0 deletions test/vmtester/tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ TEST_F(evmc_vm_test, execute)
if (result.output_data == NULL)
{
EXPECT_EQ(result.output_size, 0);
} else {
std::cout << result.output_data[0] << std::endl;
}

if (result.release)
Expand Down

0 comments on commit 610f520

Please sign in to comment.