From f8b9a403049339e27b6b27db32e750670d2f1571 Mon Sep 17 00:00:00 2001 From: francois Date: Wed, 24 Apr 2024 21:34:15 +0200 Subject: [PATCH] use is_null to check for pointer nulleness --- x/programs/rust/wasmlanche-sdk/src/memory.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x/programs/rust/wasmlanche-sdk/src/memory.rs b/x/programs/rust/wasmlanche-sdk/src/memory.rs index 3ae2886349..a449f1f056 100644 --- a/x/programs/rust/wasmlanche-sdk/src/memory.rs +++ b/x/programs/rust/wasmlanche-sdk/src/memory.rs @@ -100,7 +100,7 @@ pub extern "C" fn alloc(len: usize) -> *mut u8 { let layout = Layout::array::(len).expect("capacity overflow"); // take a mutable pointer to the layout let ptr = unsafe { std::alloc::alloc(layout) }; - if ptr as *const _ == std::ptr::null() { + if ptr.is_null() { std::alloc::handle_alloc_error(layout); } // keep track of the pointer and the length of the allocated data