summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRoger Dingledine <arma@torproject.org>2007-07-22 06:32:28 +0000
committerRoger Dingledine <arma@torproject.org>2007-07-22 06:32:28 +0000
commit5190916670f66633cf84690ee3937b634bde66ff (patch)
tree6c81f8428ed5cba508c72f3eb45d77e1d93a53fc /src
parente96d807db4c798f3794d24aed8a38fa7cc5cf3fa (diff)
downloadtor-5190916670f66633cf84690ee3937b634bde66ff.tar.gz
tor-5190916670f66633cf84690ee3937b634bde66ff.zip
free a small static string on exit.
svn:r10902
Diffstat (limited to 'src')
-rw-r--r--src/or/main.c1
-rw-r--r--src/or/routerlist.c6
2 files changed, 6 insertions, 1 deletions
diff --git a/src/or/main.c b/src/or/main.c
index d4dd8b3247..7b89bd7294 100644
--- a/src/or/main.c
+++ b/src/or/main.c
@@ -1784,6 +1784,7 @@ tor_free_all(int postfork)
tor_free(timeout_event);
/* Stuff in util.c */
escaped(NULL);
+ esc_router_info(NULL);
if (!postfork) {
logs_free_all(); /* free log strings. do this last so logs keep working. */
}
diff --git a/src/or/routerlist.c b/src/or/routerlist.c
index 19b8eed850..e362cfe0d1 100644
--- a/src/or/routerlist.c
+++ b/src/or/routerlist.c
@@ -5391,15 +5391,19 @@ routerlist_check_bug_417(void)
* THIS FUNCTION IS NOT REENTRANT. Don't call it from outside the main
* thread. Also, each call invalidates the last-returned value, so don't
* try log_warn(LD_GENERAL, "%s %s", esc_router_info(a), esc_router_info(b));
+ *
+ * If <b>router</b> is NULL, it just frees its internal memory and returns.
*/
const char *
esc_router_info(routerinfo_t *router)
{
- static char *info;
+ static char *info=NULL;
char *esc_contact, *esc_platform;
size_t len;
if (info)
tor_free(info);
+ if (!router)
+ return NULL; /* we're exiting; just free the memory we use */
esc_contact = esc_for_log(router->contact_info);
esc_platform = esc_for_log(router->platform);