From 66e218120eaab92a89a8cc44c4c2a135b39909f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20Mei=C3=9Fner?= Date: Fri, 1 Sep 2023 10:37:56 +0200 Subject: [PATCH] Adds error message in case std::alloc::alloc() fails. --- src/jit.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/jit.rs b/src/jit.rs index 26a9a50ac..ec4890ea1 100644 --- a/src/jit.rs +++ b/src/jit.rs @@ -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::()) as *mut EbpfError; + assert!(!err_ptr.is_null(), "std::alloc::alloc() failed"); *result = ProgramResult::Err(Box::from_raw(err_ptr)); err_ptr }