[tor-bugs] #28592 [Core Tor/Tor]: Spurious coverity memory leak error

Tor Bug Tracker & Wiki blackhole at torproject.org
Fri Nov 23 07:35:27 UTC 2018


#28592: Spurious coverity memory leak error
------------------------------+--------------------------------
     Reporter:  teor          |      Owner:  (none)
         Type:  defect        |     Status:  new
     Priority:  Medium        |  Milestone:  Tor: 0.4.0.x-final
    Component:  Core Tor/Tor  |    Version:  Tor: unspecified
     Severity:  Normal        |   Keywords:
Actual Points:                |  Parent ID:
       Points:                |   Reviewer:
      Sponsor:                |
------------------------------+--------------------------------
 Coverity says:
 {{{
 ** CID 1441482:  Resource leaks  (RESOURCE_LEAK)
 /src/core/or/versions.c: 402 in memoize_protover_summary()


 ________________________________________________________________________________________________________
 *** CID 1441482:  Resource leaks  (RESOURCE_LEAK)
 /src/core/or/versions.c: 402 in memoize_protover_summary()
 396     {
 397       if (!protover_summary_map)
 398         protover_summary_map = strmap_new();
 399
 400       if (strmap_size(protover_summary_map) >=
 MAX_PROTOVER_SUMMARY_MAP_LEN) {
 401         protover_summary_cache_free_all();
    CID 1441482:  Resource leaks  (RESOURCE_LEAK)
    Overwriting "protover_summary_map" in "protover_summary_map =
 strmap_new()" leaks the storage that "protover_summary_map" points to.
 402         protover_summary_map = strmap_new();
 403       }
 404
 405       const protover_summary_flags_t *cached =
 406         strmap_get(protover_summary_map, protocols);
 }}}

 But `protover_summary_cache_free_all();` frees protover_summary_map.

 cc'ing nickm, because the original fix was his.

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


More information about the tor-bugs mailing list