diff --git a/src/jit.rs b/src/jit.rs index 22a86d6b..f9cf8699 100644 --- a/src/jit.rs +++ b/src/jit.rs @@ -1259,10 +1259,10 @@ impl<'a, V: Verifier, C: ContextObject> JitCompiler<'a, V, C> { // Routine for allocating errors self.set_anchor(ANCHOR_ALLOCATE_EXCEPTION); - unsafe fn allocate_error(result: &mut ProgramResult) -> *mut EbpfError { + unsafe fn allocate_error(result: *mut ProgramResult) -> *mut EbpfError { let err_ptr = std::alloc::alloc(std::alloc::Layout::new::()) as *mut EbpfError; assert!(!err_ptr.is_null(), "std::alloc::alloc() failed"); - *result = ProgramResult::Err(Box::from_raw(err_ptr)); + result.write(ProgramResult::Err(Box::from_raw(err_ptr))); err_ptr } self.emit_ins(X86Instruction::lea(OperandSize::S64, RBP, R10, Some(X86IndirectAccess::Offset(self.slot_on_environment_stack(RuntimeEnvironmentSlot::ProgramResult)))));