Skip to content

Commit

Permalink
zephyr: alloc: virtual_heap_free: Panic on deallocations errors
Browse files Browse the repository at this point in the history
Add k_panic() function call in error handling code to help detect potential
memory release errors.

Signed-off-by: Adrian Warecki <[email protected]>
  • Loading branch information
softwarecki committed Jan 15, 2025
1 parent d1d1ff7 commit 594bf98
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion zephyr/lib/alloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -257,8 +257,10 @@ static void virtual_heap_free(void *ptr)
ptr = (__sparse_force void *)sys_cache_cached_ptr_get(ptr);

ret = vmh_free(heap, ptr);
if (ret)
if (ret) {
tr_err(&zephyr_tr, "Unable to free %p! %d", ptr, ret);
k_panic();
}
}

static const struct vmh_heap_config static_hp_buffers = {
Expand Down

0 comments on commit 594bf98

Please sign in to comment.