res_srtp: Fix a crash caused by srtp_dealloc on an already dealloced session
authorJonathan Rose <jrose@digium.com>
Wed, 5 Dec 2012 17:17:06 +0000 (17:17 +0000)
committerJonathan Rose <jrose@digium.com>
Wed, 5 Dec 2012 17:17:06 +0000 (17:17 +0000)
commitd7372766dc236a48192d2e7f28617d65b16836fb
tree5bdfd94afb3ed2fc722a076ae36f608bfbe272de
parentb206511914c7dde1ae5987ad994fcdff1dda8bb8
res_srtp: Fix a crash caused by srtp_dealloc on an already dealloced session

When srtp_create fails, the session may be dealloced or just not alloced. At
the same time though, the session pointer might not be set to NULL in this
process and attempting to srtp_dealloc it again will cause a segfault. This
patch checks for failure of srtp_create and sets the session pointer to NULL
if it fails.

(closes issue ASTERISK-20499)
Reported by: tootai
Review: https://reviewboard.asterisk.org/r/2228/
........

Merged revisions 377256 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

Merged revisions 377261 from http://svn.asterisk.org/svn/asterisk/branches/10
........

Merged revisions 377262 from http://svn.asterisk.org/svn/asterisk/branches/11

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@377263 65c4cc65-6c06-0410-ace0-fbb531ad65f3
res/res_srtp.c