diff options
author | Nick Mathewson <nickm@torproject.org> | 2017-12-21 08:50:41 -0500 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2017-12-21 08:50:41 -0500 |
commit | 5db94adac24a3418d6dcef0078cea330d76ae442 (patch) | |
tree | 77ac3799df3f3945235698b3a15b68f8c6110dbc | |
parent | bac0bcbba191b30836fe305223265b4028d584cf (diff) | |
download | tor-5db94adac24a3418d6dcef0078cea330d76ae442.tar.gz tor-5db94adac24a3418d6dcef0078cea330d76ae442.zip |
Fix a pair of memory leaks in tor_cleanup()
Spotted by coverity scan as 1426749 and 1426750
Bug not in any released Tor.
-rw-r--r-- | src/or/main.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/or/main.c b/src/or/main.c index 7f55f1210d..e449b95b91 100644 --- a/src/or/main.c +++ b/src/or/main.c @@ -3504,10 +3504,17 @@ tor_cleanup(void) /* Remove control port file */ tor_remove_file(options->ControlPortWriteToFile); /* Remove cookie authentication file */ - tor_remove_file(get_controller_cookie_file_name()); + { + char *cookie_fname = get_controller_cookie_file_name(); + tor_remove_file(cookie_fname); + tor_free(cookie_fname); + } /* Remove Extended ORPort cookie authentication file */ - tor_remove_file(get_ext_or_auth_cookie_file_name()); - + { + char *cookie_fname = get_ext_or_auth_cookie_file_name(); + tor_remove_file(cookie_fname); + tor_free(cookie_fname); + } if (accounting_is_enabled(options)) accounting_record_bandwidth_usage(now, get_or_state()); or_state_mark_dirty(get_or_state(), 0); /* force an immediate save. */ |