Skip to content

Commit 9fc5afd

Browse files
authored
OOM: avoid warn when calling *alloc(0) (esp8266#7909)
1 parent d3d49d5 commit 9fc5afd

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

cores/esp8266/heap.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -194,8 +194,8 @@ void ICACHE_RAM_ATTR print_oom_size(size_t size)
194194
}
195195
}
196196

197-
#define OOM_CHECK__PRINT_OOM(p, s) if (!p) print_oom_size(s)
198-
#define OOM_CHECK__PRINT_LOC(p, s, f, l) if (!p) print_loc(s, f, l)
197+
#define OOM_CHECK__PRINT_OOM(p, s) if ((s) && !(p)) print_oom_size(s)
198+
#define OOM_CHECK__PRINT_LOC(p, s, f, l) if ((s) && !(p)) print_loc(s, f, l)
199199

200200
#else // ! DEBUG_ESP_OOM
201201

0 commit comments

Comments
 (0)