summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2012-10-17 11:29:59 -0400
committerNick Mathewson <nickm@torproject.org>2012-10-17 11:29:59 -0400
commit850c9901445a1d2a4ce7ecf16e03f939fcd821d6 (patch)
treecbafa7387682db02a54433fd55c921a804ae2b16
parentcb9d1237641290dc92b11540b96db036748429be (diff)
downloadtor-850c9901445a1d2a4ce7ecf16e03f939fcd821d6.tar.gz
tor-850c9901445a1d2a4ce7ecf16e03f939fcd821d6.zip
Fix a bug in channel_dump_statistics
We were calling channel_get_actual_remote_descr() before we used the output of a previous channel_get_canonical_remote_descr(), thus invalidating its output.
-rw-r--r--src/or/channel.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/or/channel.c b/src/or/channel.c
index 3acb509a14..89ec4de0b8 100644
--- a/src/or/channel.c
+++ b/src/or/channel.c
@@ -3243,6 +3243,7 @@ channel_dump_statistics(channel_t *chan, int severity)
/* Handle remote address and descriptions */
have_remote_addr = channel_get_addr_if_possible(chan, &remote_addr);
if (have_remote_addr) {
+ char *actual = tor_strdup(channel_get_actual_remote_descr(chan));
remote_addr_str = tor_dup_addr(&remote_addr);
log(severity, LD_GENERAL,
" * Channel " U64_FORMAT " says its remote address"
@@ -3251,16 +3252,19 @@ channel_dump_statistics(channel_t *chan, int severity)
U64_PRINTF_ARG(chan->global_identifier),
remote_addr_str,
channel_get_canonical_remote_descr(chan),
- channel_get_actual_remote_descr(chan));
+ actual);
tor_free(remote_addr_str);
+ tor_free(actual);
} else {
+ char *actual = tor_strdup(channel_get_actual_remote_descr(chan));
log(severity, LD_GENERAL,
" * Channel " U64_FORMAT " does not know its remote "
"address, but gives a canonical description of \"%s\" and an "
"actual description of \"%s\"",
U64_PRINTF_ARG(chan->global_identifier),
channel_get_canonical_remote_descr(chan),
- channel_get_actual_remote_descr(chan));
+ actual);
+ tor_free(actual);
}
/* Handle marks */