Original Message
From: Zack Weinberg
To: tor-dev@lists.torproject.org
Subject: Re: [tor-dev] Remove NULL checks for *_free() calls
Date: Mon, 31 Aug 2015 10:29:31 -0400
> > But you did find some places they forgot to assign NULL after free.
>
> Unfortunately, sett
On Sun, Aug 30, 2015 at 10:37 PM, Mansour Moufid
wrote:
> On Sun, Aug 30, 2015 at 8:13 PM, Michael McConville
> wrote:
>
>> free() is specified to be NULL-safe, and I don't know of any
>> implementations that violate this.
>
> I think those NULL checks are meant to avoid double-free bugs. If you
On Sun, 30 Aug 2015 23:24:07 +, 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.
>
>
Mansour Moufid wrote:
> Michael McConville wrote:
> > free() is specified to be NULL-safe, and I don't know of any
> > implementations that violate this.
>
> I think those NULL checks are meant to avoid double-free bugs. If you
> assign NULL to a pointer after you free it and check all pointers
>
free() is specified to be NULL-safe, and I don't know of any
implementations that violate this. Tor's *_free() functions conform,
although relaycache_free() prints a warning (which I remove in the below
diff).
I checked every *_free() function for NULL-safety before removing
conditions for it. Thi