summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/or/connection.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/or/connection.c b/src/or/connection.c
index 85449b43a4..82f5e82bd6 100644
--- a/src/or/connection.c
+++ b/src/or/connection.c
@@ -858,12 +858,14 @@ retry_listeners(int type, config_line_t *cfg,
line = NULL;
SMARTLIST_FOREACH(launch, config_line_t *, wanted,
{
- char *addr;
+ char *addr=NULL;
uint16_t port;
if (! parse_addr_port(wanted->value, &addr, NULL, &port)) {
+ int addr_matches = !strcasecmp(addr, conn->address);
+ tor_free(addr);
if (! port)
port = port_option;
- if (port == conn->port && !strcasecmp(addr, conn->address)) {
+ if (port == conn->port && addr_matches) {
line = wanted;
break;
}