Re: Bug #72828
| From: | Stanislav Malyshev | Date: | Sun, 14 Aug 2016 08:21:13 +0000 |
| Subject: | Re: Bug #72828 | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-95129@lists.php.net to get a copy of this message | ||
Hi!
> You have commented on
> <https://bugs.php.net/bug.php?id=72828>:
>
> | Unless the allocations explicitly use the system allocator (i.e. do
> | not use emalloc and variants), do NOT introduce NULL checks.
>
> Can you please elaborate, why that shouldn't be done.
>
> Actually, the allocations use safe_emalloc() and emalloc(),
> respectively[1]. However, the only client of the function does
These do not need null checks. If e* functions can't alloc memory, they
produce fatal error, bail out and do not return. So if it returned, it
succeeded. The only reason why it can return null is a bug. In this case
we'd prefer it crashing fast - bugs in memory allocator are hard to
find, and closer to the source the crash is, easier it to catch it.
If pe* or system functions are used, then check may be warranted.
--
Stas Malyshev
smalyshev@gmail.com