heap: add a unit test for malloc(0) and slightly optimize heap_caps_malloc_prefer

This commit is contained in:
Omar Chebib
2022-08-08 15:39:25 +08:00
parent ee4d15d02f
commit c6ddf7288c
2 changed files with 23 additions and 1 deletions

View File

@@ -259,7 +259,7 @@ IRAM_ATTR void *heap_caps_malloc_prefer( size_t size, size_t num, ... )
while (num--) {
caps = va_arg( argp, uint32_t );
r = heap_caps_malloc_base( size, caps );
if (r != NULL) {
if (r != NULL || size == 0) {
break;
}
}