From 75dd7b1a945f6d21d134d3cb5da27f8b622588e7 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Fri, 9 Oct 2026 12:37:23 -1000 Subject: [PATCH] Note that IDF's aligned_alloc has no size multiple requirement --- esphome/components/esp32/operator_new.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/esphome/components/esp32/operator_new.cpp b/esphome/components/esp32/operator_new.cpp index e5dfe83ea0c..73e498c80c9 100644 --- a/esphome/components/esp32/operator_new.cpp +++ b/esphome/components/esp32/operator_new.cpp @@ -59,7 +59,8 @@ void *plain_alloc(std::size_t size) { return alloc_or_null(size, [](std::size_t n) { return std::malloc(n); }); // NOLINT(cppcoreguidelines-no-malloc) } -// libstdc++'s aligned delete frees with free() (checked above), which matches IDF's aligned_alloc() +// IDF's aligned_alloc accepts any size (no C11 multiple of alignment rule) and pairs with free(), +// which libstdc++'s aligned delete uses (checked above) void *aligned_alloc_or_null(std::size_t size, std::align_val_t align) { return alloc_or_null(size, [align](std::size_t n) { return ::aligned_alloc(static_cast(align), n); }); }