Skip to content

Commit 594bf98

Browse files
committed
zephyr: alloc: virtual_heap_free: Panic on deallocations errors
Add k_panic() function call in error handling code to help detect potential memory release errors. Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
1 parent d1d1ff7 commit 594bf98

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

zephyr/lib/alloc.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,8 +257,10 @@ static void virtual_heap_free(void *ptr)
257257
ptr = (__sparse_force void *)sys_cache_cached_ptr_get(ptr);
258258

259259
ret = vmh_free(heap, ptr);
260-
if (ret)
260+
if (ret) {
261261
tr_err(&zephyr_tr, "Unable to free %p! %d", ptr, ret);
262+
k_panic();
263+
}
262264
}
263265

264266
static const struct vmh_heap_config static_hp_buffers = {

0 commit comments

Comments
 (0)