httpd-modules-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nick Kew <...@apache.org>
Subject Re: apr_palloc return value?
Date Wed, 08 Apr 2009 20:13:09 GMT
On Wed, 8 Apr 2009 22:07:55 +0300
Juha Korhonen <mahtavata@gmail.com> wrote:

> Hi, when I use apr_palloc function to allocate memory, should I check
> the return value to make sure that I really got some memory?

Yes.

Sort-of.

That is to say, yes you should, but it's common practice to omit
the test, on the dubious grounds that if pool allocation fails,
then your error handling is pretty-much going to fail for the
same reason so it's pointless.

With apr exploring entirely different allocators, that excuse
looks ever more suspect.  So, yes, you're right.

-- 
Nick Kew

Application Development with Apache - the Apache Modules Book
http://www.apachetutor.org/

Mime
View raw message