Re: Bug #72828

From: Date: Sun, 14 Aug 2016 21:32:43 +0000
Subject: Re: Bug #72828
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-95148@lists.php.net to get a copy of this message
Hi! On 14.08.2016 at 10:21, Stanislav Malyshev wrote: >> 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. Thanks! I had already closed the bug report, because the issue affects only PHP 5.6, and I don't think this extraneous NULL check is a real bug. Please re-open if you don't agree, in which case I'll remove the NULL check. -- Christoph M. Becker

« previous php.internals (#95148) next »