Skip to content

Commit

Permalink
use is_null to check for pointer nulleness
Browse files Browse the repository at this point in the history
  • Loading branch information
iFrostizz committed Apr 24, 2024
1 parent 739fd00 commit f8b9a40
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion x/programs/rust/wasmlanche-sdk/src/memory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ pub extern "C" fn alloc(len: usize) -> *mut u8 {
let layout = Layout::array::<u8>(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
Expand Down

0 comments on commit f8b9a40

Please sign in to comment.