From 1ac29cd22623e108e589a2f4193775f3ce20566e Mon Sep 17 00:00:00 2001 From: Adrian Warecki Date: Wed, 15 Jan 2025 16:19:38 +0100 Subject: [PATCH] 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 --- zephyr/lib/alloc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/zephyr/lib/alloc.c b/zephyr/lib/alloc.c index 8bfe3155477d..3cfc6eb97296 100644 --- a/zephyr/lib/alloc.c +++ b/zephyr/lib/alloc.c @@ -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 = {