[tor-dev] Remove NULL checks for *_free() calls

Andreas Krey a.krey at gmx.de
Mon Aug 31 07:24:43 UTC 2015


On Sun, 30 Aug 2015 23:24:07 +0000, Michael McConville wrote:
> Mansour Moufid wrote:
> > Michael McConville wrote:
...
> > >   error:
> > > -  if (x509) {
> > > -    X509_free(x509);
> > > -    x509 = NULL;
> > > -  }
...
> > But you did find some places they forgot to assign NULL after free.
> 
> For one reason or another, this isn't common practice.

It's not my practise, at least. I would definitely not use the
x509=NULL part when the end of the function is nigh (and doesn't
do anything with x509), and for me the =NULL is almost an indication
that x509 is used somehow lateron.

Also, if there were an x509=obj->x509 previously the correct thing
would be an obj->x509=NULL.

Andreas

-- 
"Totally trivial. Famous last words."
From: Linus Torvalds <torvalds@*.org>
Date: Fri, 22 Jan 2010 07:29:21 -0800


More information about the tor-dev mailing list