diff --git a/src/or/control.c b/src/or/control.c
index b6ba12702e73a26df232f20f2fc37df4f0f5b357..03b42af5393f2231269af16ad69c9bf95cddbada 100644
--- a/src/or/control.c
+++ b/src/or/control.c
@@ -4750,3 +4750,11 @@ control_event_clients_seen(const char *controller_str)
     "650 CLIENTS_SEEN %s\r\n", controller_str);
 }
 
+/** Free any leftover allocated memory of the control.c subsystem. */
+void
+control_free_all(void)
+{
+  if (authentication_cookie) /* Free the auth cookie */
+    tor_free(authentication_cookie);
+}
+
diff --git a/src/or/control.h b/src/or/control.h
index 3b2004bffe320cfd4db68f9bdb11fa1ed2c490b3..be9476ea3f1439f3652fb3552c364644a818caf8 100644
--- a/src/or/control.h
+++ b/src/or/control.h
@@ -89,6 +89,7 @@ MOCK_DECL(void, control_event_bootstrap_problem,(const char *warn,
                                                  int reason));
 
 void control_event_clients_seen(const char *controller_str);
+void control_free_all(void);
 
 #ifdef CONTROL_PRIVATE
 /* Used only by control.c and test.c */
diff --git a/src/or/ext_orport.c b/src/or/ext_orport.c
index 272fef4d1fe74dfc95dc184fd2de5c2907a60b6f..fdcecacda217c8bf4e905b4ffcd3dbc1984abefa 100644
--- a/src/or/ext_orport.c
+++ b/src/or/ext_orport.c
@@ -633,3 +633,11 @@ connection_ext_or_start_auth(or_connection_t *or_conn)
   return 0;
 }
 
+/** Free any leftover allocated memory of the ext_orport.c subsystem. */
+void
+ext_orport_free_all(void)
+{
+  if (ext_or_auth_cookie) /* Free the auth cookie */
+    tor_free(ext_or_auth_cookie);
+}
+
diff --git a/src/or/ext_orport.h b/src/or/ext_orport.h
index 37874b56f0b027fddf040fb5c3db5481d17fc752..ce45e5f41888b4c07613c0f66a383a8374ca8247 100644
--- a/src/or/ext_orport.h
+++ b/src/or/ext_orport.h
@@ -21,6 +21,7 @@ int connection_ext_or_process_inbuf(or_connection_t *or_conn);
 
 int init_ext_or_cookie_authentication(int is_enabled);
 char *get_ext_or_auth_cookie_file_name(void);
+void ext_orport_free_all(void);
 
 #ifdef EXT_ORPORT_PRIVATE
 STATIC int connection_write_ext_or_command(connection_t *conn,
diff --git a/src/or/main.c b/src/or/main.c
index d8f86bcec44542f7e8f78fad65deaea6533a5c83..33e1c6437f57a820a2f37b2bed198d6c9a20a45c 100644
--- a/src/or/main.c
+++ b/src/or/main.c
@@ -52,6 +52,7 @@
 #include "routerparse.h"
 #include "statefile.h"
 #include "status.h"
+#include "ext_orport.h"
 #ifdef USE_DMALLOC
 #include <dmalloc.h>
 #include <openssl/crypto.h>
@@ -2510,6 +2511,8 @@ tor_free_all(int postfork)
   memarea_clear_freelist();
   nodelist_free_all();
   microdesc_free_all();
+  ext_orport_free_all();
+  control_free_all();
   if (!postfork) {
     config_free_all();
     or_state_free_all();