diff options
author | IOhannes m zmölnig <zmoelnig@users.sourceforge.net> | 2010-03-22 15:29:31 +0000 |
---|---|---|
committer | IOhannes m zmölnig <zmoelnig@users.sourceforge.net> | 2010-03-22 15:29:31 +0000 |
commit | 37d1ba3860502e9105084a17405d67f0ed7e13d6 (patch) | |
tree | 55f29fde038a766f8e28d36159197ac71d364a91 /net | |
parent | 1f5a5bbe0f5f0fc07d5635d499eee149b2c83843 (diff) |
check for NULL-pointer in destructor
svn path=/trunk/externals/mrpeach/; revision=13238
Diffstat (limited to 'net')
-rw-r--r-- | net/tcpserver.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/net/tcpserver.c b/net/tcpserver.c index 1e63e3b..5272029 100644 --- a/net/tcpserver.c +++ b/net/tcpserver.c @@ -1028,12 +1028,15 @@ static void tcpserver_free(t_tcpserver *x) for(i = 0; i < MAX_CONNECT; i++) { - if (x->x_sr[i]->sr_fd >= 0) - { - sys_rmpollfn(x->x_sr[i]->sr_fd); - sys_closesocket(x->x_sr[i]->sr_fd); + + if (NULL!=x->x_sr[i]) { + tcpserver_socketreceiver_free(x->x_sr[i]); + if (x->x_sr[i]->sr_fd >= 0) + { + sys_rmpollfn(x->x_sr[i]->sr_fd); + sys_closesocket(x->x_sr[i]->sr_fd); + } } - if (x->x_sr[i] != NULL) tcpserver_socketreceiver_free(x->x_sr[i]); } if (x->x_connectsocket >= 0) { |