Commit a6493fa
authored
fix: avoid OOM caused by NULL pointer returned from malloc(0) (#1822)
### Motivation
It's left to the implementations of malloc if a `malloc(0)` returns a
NULL pointer or a non-null pointer. However, our validation logic checks
if a NULL pointer is returned and treats it as an OOM.
### Modification
Always pass at least 1 to malloc, ensuring that we only get a NULL
pointer if we're really out of memory.
### Result
No more OOM errors thrown because of `malloc(0)` calls returning a NULL
pointer.1 parent fa6abf7 commit a6493fa
File tree
1 file changed
+3
-1
lines changed- driver/impl/src/main/java/eu/cloudnetservice/driver/impl/network/netty/memory
1 file changed
+3
-1
lines changedLines changed: 3 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
72 | 72 | | |
73 | 73 | | |
74 | 74 | | |
75 | | - | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
76 | 78 | | |
77 | 79 | | |
78 | 80 | | |
| |||
0 commit comments