[tor-bugs] #24484 [Core Tor/Tor]: free(NULL) always works (nowadays) so stop acting like it might not

Tor Bug Tracker & Wiki blackhole at torproject.org
Wed Dec 6 19:05:54 UTC 2017


#24484: free(NULL) always works (nowadays) so stop acting like 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        |     Resolution:
 Keywords:  easy          |  Actual Points:
Parent ID:                |         Points:
 Reviewer:                |        Sponsor:
--------------------------+------------------------------------

Comment (by catalyst):

 Replying to [comment:2 aruna1234]:
 > so, this requires a change  in the comments?
 > What are the new comments that are required?

 It requires both a comment change and a code change.  `tor_free()` and
 possibly related functions and macros conditionally call the real `free()`
 function when it should be unconditional.  They should instead
 unconditionally call `free()`.

 We should fix or remove existing comments that suggest or imply that
 `free(NULL)` is invalid in modern C.  In the original description, I
 quoted one of the comments that needs changing.  Perhaps you will find
 others.

 Please be aware that #24337 touches a lot of related code so you might
 want to wait until it's merged before working on this.  (nickm, what do
 you think is best here for sequencing?)

--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/24484#comment:3>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online


More information about the tor-bugs mailing list