Re: two patches: avoid NULL-dereference

Jim Meyering <[email protected]>
Newsgroups gmane.comp.web.polipo.user
Message-ID <[email protected]>
Juliusz Chroboczek wrote:
>> Or better still, if that's the semantics you want, simply
>> insert the return statement above:
>
> No.  We need to ensure specialRequestHandler is run.  I'm not quite sure
> how to do that.

Currently, it requires a malloc'd "request", which it frees.
If you know enough about the configuration to place a limit on
the number of concurrent calls to specialRequestHandler,
allocate that maximum number of buffers up-front,
and then use them when/if malloc fails.

Assuming you can compute/define/guess such a maximum, ...
You might even be able to avoid using malloc for request storage altogether:
allocate a single large buffer up front and maintain a list of which
requests are in-use.  Then, rather than freeing a buffer,
specialRequestHandler would just mark it as no longer in use.

------------------------------------------------------------------------------
Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
Finally, a world-class log management solution at an even better price-free!
Download using promo code Free_Logger_4_Dev2Dev. Offer expires 
February 28th, so secure your free ArcSight Logger TODAY! 
http://p.sf.net/sfu/arcsight-sfd2d
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.