mirror of
https://github.com/esp8266/Arduino.git
synced 2025-06-04 18:03:20 +03:00
force all os_malloc calls to request a aligned size.
- this fix Fatal exception (9) by unaligned class memory
This commit is contained in:
parent
e50fc0fef8
commit
e0f9a4173e
@ -26,10 +26,12 @@ extern "C" {
|
||||
}
|
||||
|
||||
void *operator new(size_t size) {
|
||||
size = ((size + 3) & ~((size_t)0x3));
|
||||
return os_malloc(size);
|
||||
}
|
||||
|
||||
void *operator new[](size_t size) {
|
||||
size = ((size + 3) & ~((size_t)0x3));
|
||||
return os_malloc(size);
|
||||
}
|
||||
|
||||
|
@ -38,6 +38,7 @@
|
||||
#include "user_interface.h"
|
||||
|
||||
void* malloc(size_t size) {
|
||||
size = ((size + 3) & ~((size_t)0x3));
|
||||
return os_malloc(size);
|
||||
}
|
||||
|
||||
@ -46,6 +47,7 @@ void free(void* ptr) {
|
||||
}
|
||||
|
||||
void* realloc(void* ptr, size_t size) {
|
||||
size = ((size + 3) & ~((size_t)0x3));
|
||||
return os_realloc(ptr, size);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user