apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Cliff Woolley <jwool...@virginia.edu>
Subject Re: [PATCH] check NULL in apr_bucket_alloc
Date Wed, 03 Sep 2003 02:01:28 GMT
On Tue, 2 Sep 2003, Jean-Jacques Clar wrote:

> In the case that a server is running out of memory (yeah, I know it
> never happens), apr_allocator_alloc() is returning NULL, but it is never
> checked for in apr_bucket_alloc(). Does the bucket alloc function should
> pass that NULL back to the function/application asking for memory?

It's a tough question.  APR has mostly taken the "policy" of
no-checks-for-NULL on allocations and such, so that's what I opted to go
with when I wrote that function (ie, just segfault instead of check).

Even if the bucket allocator did return the NULL, none of the code that
calls apr_bucket_alloc() checks for it either anyway.  If you want it not
to segfault, the easiest way is to set an abort function in the
apr_allocator().  Other than that, my gut feeling is to leave it the way
it is.  But I'd like to hear other opinions on this.

Count me as a -0 but willing to be swayed.


View raw message