]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Fix a pair of memory leaks in tor_cleanup()
authorNick Mathewson <nickm@torproject.org>
Thu, 21 Dec 2017 13:50:41 +0000 (08:50 -0500)
committerNick Mathewson <nickm@torproject.org>
Thu, 21 Dec 2017 13:50:41 +0000 (08:50 -0500)
Spotted by coverity scan as 1426749 and 1426750

Bug not in any released Tor.

src/or/main.c

index 7f55f1210dfa47eea7474327cfd4ad7d4d6734fa..e449b95b916725644d3df2c2827e893229fd9aba 100644 (file)
@@ -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. */