On 8/25/15, Dan Kennedy <danielk1977 at gmail.com> wrote:
> On 08/25/2015 11:36 PM, Bill Parker wrote:
>>
>> The patch file below should catch and handle all conditions where
>> Tcl_Alloc() is called, but are NOT checked for a return value of NULL:
>
> Does Tcl_Alloc() actually return NULL if a malloc fails? I thought if
> memory can not be allocated it calls Tcl_Panic() to report an error
> message and then aborts the process.
>

Sure enough.  http://tmml.sourceforge.net/doc/tcl/Alloc.html says that
you have to use Tcl_AttemptAlloc() if you want a NULL pointer returned
on OOM.  Tcl_Alloc() always panics.  See
http://core.tcl.tk/tcl/artifact/d25497d9849b8704?ln=1089 for the
implementation.

-- 
D. Richard Hipp
drh at sqlite.org

Reply via email to