Check all allocations for failures (OOM), not only to avoid mostly
harmless NULL-dereferences, but also UB and memory corruption caused by
optimizations.
I found the article mostly unconvincing, but I guess "We should allow undefined behavior" isn't a hill I want to die on, and the provided approach is pretty clean, so I'll take this. Thanks!
Check all allocations for failures (OOM), not only to avoid mostly harmless NULL-dereferences, but also UB and memory corruption caused by optimizations.
See also: https://pvs-studio.com/en/blog/posts/cpp/0938/
Occurrences: grep -REw "(malloc|calloc|strdup|strndup|realloc|reallocarray)" src/