Re: A review of the latest Polipo commits

Richard Zidlicky <[email protected]>
Newsgroups gmane.comp.web.polipo.user
Message-ID <[email protected]>
Hi,



> 2. "Remove dead store in..."
> 
> I'm certainly not a big fan of these changes.  There are good reasons
> for these stores, even though clang detects them as dead.
> 
> My policy is that I never write
> 
>   free(p);
> 
> but instead write
> 
>   free(p);
>   p = NULL;
> 
> even when I'm not going to use p afterwards.
> 
> The reason for that is that in the former case, if I use p afterwards
> I'm going to get a mysterious malloc arena corruption.  With the NULL
> assignment, I'm guaranteed to get a reliable crash.
> 
> Similarly, I do
> 
>   close(fd);
>   fd = -1;

indeed good practice. Also possible to hide this in some macro/function,
silencing code analysis and making it slightly more consistent.

Richard

------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev
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.