From e7aaea240d0d1fcadcc699dec85649ccb6d83b77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20Mei=C3=9Fner?= Date: Tue, 12 Sep 2023 22:03:48 +0200 Subject: [PATCH] Stops using assign as that drops the previously (non) existing value. (#513) --- src/jit.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/jit.rs b/src/jit.rs index ec4890ea..663a14ed 100644 --- a/src/jit.rs +++ b/src/jit.rs @@ -1329,10 +1329,10 @@ impl<'a, C: ContextObject> JitCompiler<'a, 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)))));