Skip to content

Commit

Permalink
Adds error message in case std::alloc::alloc() fails.
Browse files Browse the repository at this point in the history
  • Loading branch information
Lichtso committed Sep 1, 2023
1 parent 25c0b79 commit 66e2181
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/jit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1331,6 +1331,7 @@ impl<'a, C: ContextObject> JitCompiler<'a, C> {
self.set_anchor(ANCHOR_ALLOCATE_EXCEPTION);
unsafe fn allocate_error(result: &mut ProgramResult) -> *mut EbpfError {
let err_ptr = std::alloc::alloc(std::alloc::Layout::new::<EbpfError>()) as *mut EbpfError;
assert!(!err_ptr.is_null(), "std::alloc::alloc() failed");
*result = ProgramResult::Err(Box::from_raw(err_ptr));
err_ptr
}
Expand Down

0 comments on commit 66e2181

Please sign in to comment.