Skip to content

Commit

Permalink
Fix check when ESP_ABORT_ON_MALLOC_FAILURE is enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
rojer committed Jun 24, 2021
1 parent f5cd55a commit d0110e1
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions platforms/esp8266/src/esp_libc.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ void *malloc(size_t size) {
res = (void *) umm_malloc(size);
esp_check_stack_overflow(1, (int) size, res);
#ifdef ESP_ABORT_ON_MALLOC_FAILURE
if (res == NULL) abort();
if (res == NULL && size != 0) abort();
#endif
return res;
}
Expand All @@ -71,7 +71,7 @@ void *realloc(void *ptr, size_t size) {
esp_check_stack_overflow(3, (int) size, ptr);
res = (void *) umm_realloc(ptr, size);
#ifdef ESP_ABORT_ON_MALLOC_FAILURE
if (res == NULL) abort();
if (res == NULL && size != 0) abort();
#endif
esp_check_stack_overflow(4, (int) size, res);
return res;
Expand All @@ -83,7 +83,7 @@ void *calloc(size_t num, size_t size) {
esp_check_stack_overflow(5, (int) (num * size), NULL);
res = (void *) umm_calloc(num, size);
#ifdef ESP_ABORT_ON_MALLOC_FAILURE
if (res == NULL) abort();
if (res == NULL && size != 0) abort();
#endif
esp_check_stack_overflow(5, (int) (num * size), res);
return res;
Expand Down

0 comments on commit d0110e1

Please sign in to comment.