(trunk libT) fix #2534: if port forwarding is disabled, tr_sessionClose() closes a random file descriptor

This commit is contained in:
Charles Kerr 2009-10-27 20:29:02 +00:00
parent 858e691381
commit bcce43021f
1 changed files with 3 additions and 1 deletions

View File

@ -81,6 +81,7 @@ tr_natpmpInit( void )
nat = tr_new0( struct tr_natpmp, 1 );
nat->state = TR_NATPMP_DISCOVER;
nat->port = -1;
nat->natpmp.s = -1; /* socket */
return nat;
}
@ -89,7 +90,8 @@ tr_natpmpClose( tr_natpmp * nat )
{
if( nat )
{
closenatpmp( &nat->natpmp );
if( nat->natpmp.s >= 0 )
tr_netCloseSocket( nat->natpmp.s );
tr_free( nat );
}
}