From 5eab3318ff4d1146740f8e870ea57021551ad0b3 Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Fri, 30 Apr 2010 17:38:40 +0000 Subject: [PATCH] (trunk libT) #3117 "Tracker queries to not honor bind-address-ipv4" -- fix a crash-on-shutdown reported by Waldorf in #3181. The crash was introduced by r10535 for #3117 --- libtransmission/session.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/libtransmission/session.c b/libtransmission/session.c index 2f836ec1e..14b35fda6 100644 --- a/libtransmission/session.c +++ b/libtransmission/session.c @@ -214,12 +214,16 @@ open_incoming_peer_port( tr_session * session ) const tr_address* tr_sessionGetPublicAddress( const tr_session * session, int tr_af_type ) { + const struct tr_bindinfo * bindinfo; + switch( tr_af_type ) { - case TR_AF_INET: return &session->public_ipv4->addr; - case TR_AF_INET6: return &session->public_ipv6->addr; break; - default: return NULL; + case TR_AF_INET: bindinfo = session->public_ipv4; break; + case TR_AF_INET6: bindinfo = session->public_ipv6; break; + default: bindinfo = NULL; break; } + + return bindinfo ? &bindinfo->addr : NULL; } /***