@oni-link This if and many others. I already started working on it, but will send these changes on a separate PR.

Sometimes, `return NULL` is used to pass the error through the call chain. It means that many more ifs can be removed, not only those right after allocation function calls.