From: George Kadianakis Date: Fri, 5 Oct 2012 00:54:29 +0000 (-0400) Subject: Don't call fmt_addr() twice in a parameter list. X-Git-Tag: tor-0.2.3.23-rc~10^2^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=721f99e495474fc7b80250ba52351b5771f0ed36;p=thirdparty%2Ftor.git Don't call fmt_addr() twice in a parameter list. --- diff --git a/changes/bug7014 b/changes/bug7014 new file mode 100644 index 0000000000..1d39103a50 --- /dev/null +++ b/changes/bug7014 @@ -0,0 +1,5 @@ + o Minor bugfixes: + - Fix two cases in src/or/transports.c where we were calling + fmt_addr() twice in a parameter list. Bug found by David + Fifield. Fixes bug 7014; bugfix on 0.2.3.9-alpha. + diff --git a/src/or/circuitbuild.c b/src/or/circuitbuild.c index a7d370c0ea..f8521c5cff 100644 --- a/src/or/circuitbuild.c +++ b/src/or/circuitbuild.c @@ -5310,19 +5310,22 @@ transport_resolve_conflicts(transport_t *t) t_tmp->marked_for_removal = 0; return 1; } else { /* same name but different addrport */ + char *new_transport_addr = tor_strdup(fmt_addr(&t->addr)); if (t_tmp->marked_for_removal) { /* marked for removal */ log_notice(LD_GENERAL, "You tried to add transport '%s' at '%s:%u' " "but there was already a transport marked for deletion at " "'%s:%u'. We deleted the old transport and registered the " - "new one.", t->name, fmt_addr(&t->addr), t->port, + "new one.", t->name, new_transport_addr, t->port, fmt_addr(&t_tmp->addr), t_tmp->port); smartlist_remove(transport_list, t_tmp); transport_free(t_tmp); + tor_free(new_transport_addr); } else { /* *not* marked for removal */ log_notice(LD_GENERAL, "You tried to add transport '%s' at '%s:%u' " "but the same transport already exists at '%s:%u'. " - "Skipping.", t->name, fmt_addr(&t->addr), t->port, + "Skipping.", t->name, new_transport_addr, t->port, fmt_addr(&t_tmp->addr), t_tmp->port); + tor_free(new_transport_addr); return -1; } }