improved error handling for ngx_alloc().