From 98bd872f3ced2b554a8411a384cd7d3cbf7986bd Mon Sep 17 00:00:00 2001 From: Guillaume Souchere Date: Tue, 26 Mar 2024 06:48:33 +0100 Subject: [PATCH] fix(heap): Wrong size propagated in alloc fail callback Propagate `n * size` as the size of the failed allocation instead of just `size` when heap_caps_calloc() fails since `n * size` is the actual number of bytes that the heap component tried to allocate. --- components/heap/heap_caps.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/heap/heap_caps.c b/components/heap/heap_caps.c index ae5e1bfda3..a354e7afba 100644 --- a/components/heap/heap_caps.c +++ b/components/heap/heap_caps.c @@ -496,7 +496,7 @@ IRAM_ATTR void *heap_caps_calloc( size_t n, size_t size, uint32_t caps) void* ptr = heap_caps_calloc_base(n, size, caps); if (!ptr && size > 0){ - heap_caps_alloc_failed(size, caps, __func__); + heap_caps_alloc_failed(n * size, caps, __func__); } return ptr;