Cleaning up chan_sip/tcptls file descriptor closing.
authorJonathan Rose <jrose@digium.com>
Wed, 30 Nov 2011 21:10:38 +0000 (21:10 +0000)
committerJonathan Rose <jrose@digium.com>
Wed, 30 Nov 2011 21:10:38 +0000 (21:10 +0000)
commit6fa827b5d0f0c071b92be4047fa6b4f008e1e200
tree141401c350fcf5583cb3c6ab22012cbff35a245d
parentcb21847e0377ef844bc8f075e0605ac5d5c84aa9
Cleaning up chan_sip/tcptls file descriptor closing.

This patch attempts to eliminate various possible instances of undefined behavior caused
by invoking close/fclose in situations where fclose may have already been issued on a
tcptls_session_instance and/or closing file descriptors that don't have a valid index
for fd (-1). Thanks for more than a little help from wdoekes.

(closes issue ASTERISK-18700)
Reported by: Erik Wallin

(issue ASTERISK-18345)
Reported by: Stephane Cazelas

(issue ASTERISK-18342)
Reported by: Stephane Chazelas

Review: https://reviewboard.asterisk.org/r/1576/

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@346525 65c4cc65-6c06-0410-ace0-fbb531ad65f3
channels/chan_sip.c
include/asterisk/tcptls.h
main/tcptls.c