[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-bugs] #24484 [Core Tor/Tor]: free(NULL) always works (nowadays) so delete comment saying that it might not



#24484: free(NULL) always works (nowadays) so delete comment saying that it might
not
------------------------------+--------------------------------
     Reporter:  catalyst      |      Owner:  (none)
         Type:  defect        |     Status:  new
     Priority:  Medium        |  Milestone:  Tor: 0.3.3.x-final
    Component:  Core Tor/Tor  |    Version:
     Severity:  Normal        |   Keywords:  easy
Actual Points:                |  Parent ID:
       Points:                |   Reviewer:
      Sponsor:                |
------------------------------+--------------------------------
 src/common/util.h has the following text in a comment:
 {{{
  * Unlike the free() function, tor_free() will still work on NULL
 pointers,
  * and it sets the pointer value to NULL after freeing it.
 }}}

 `free(NULL)` has been required to be a no-op since C89 at least.  Some
 pre-ANSI platforms might have had a libc `free()` that didn't allow a null
 pointer, but we mostly don't care about those.

 We should stop propagating this common misconception that `free(NULL)`
 might undefined on modern platforms.  We should remove that text from the
 comment and remove the conditional from the implementation.

--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/24484>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online
_______________________________________________
tor-bugs mailing list
tor-bugs@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-bugs