On Wed, Sep 1, 2010 at 6:37 AM, Graham Dumpleton <graham.dumple...@gmail.com
> wrote:

> On 1 September 2010 20:15, Graham Leggett <minf...@sharp.fm> wrote:
> > On 01 Sep 2010, at 6:07 AM, dave b wrote:
> >
> >> What is the rational behind not checking the return value of
> >> apr_palloc and apr_pcalloc?
> >
> > The rationale is to not be forced to check for and handle hundreds of
> > potential failure cases when you're probably doomed anyway.
> >
> > The APR pools API gives you the apr_pool_abort_set() function, which
> > specifies a function to call if the memory allocation fails. In the case
> of
> > httpd, a function is registered which gracefully shuts down that
> particular
> > server process if the allocation fails, and apr_palloc() is in the
> process
> > guaranteed to never return NULL.
>
> Noting that apr_pool_abort_set() is only setup in Apache 2.3 and not
> in Apache 2.2.16 or earlier. Not being in 2.X explains why I couldn't
> find it before.
>
> Any reason why setting up apr_pool_abort_set() wasn't back ported to Apache
> 2.2?
>

dunno, but here's the commit and original discussion in case anyone wants to
read

http://svn.apache.org/viewvc?view=revision&revision=406953 (dunno if it was
subsequently fixed)
http://www.mail-archive.com/dev@httpd.apache.org/msg32257.html


>
> Graham
>
> > Obviously if you're not using APR from httpd, or if you're writing a
> library
> > that depends on APR, and you haven't set an abort function, NULL will
> > potentially be returned and you should check for and handle that case.
> >
> > Regards,
> > Graham
> > --
> >
> >
>



-- 
Born in Roswell... married an alien...

Reply via email to