Skip to content

Commit c623979

Browse files
committed
Add comment on alloc_helper invariants
Signed-off-by: Tomasz Andrzejak <[email protected]>
1 parent cc20014 commit c623979

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/hyperlight_guest_bin/src/memory.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@ struct Header(Layout);
5050
/// Allocates a block of memory with the given size. The memory is only guaranteed to be initialized to 0s if `zero` is true, otherwise
5151
/// it may or may not be initialized.
5252
///
53+
/// # Invariants
54+
/// `alignment` must be non-zero and a power of two
55+
///
5356
/// # Safety
5457
/// The returned pointer must be freed with `memory::free` when it is no longer needed, otherwise memory will leak.
5558
unsafe fn alloc_helper(size: usize, alignment: usize, zero: bool) -> *mut c_void {

0 commit comments

Comments
 (0)