Merged revisions 220365 via svnmerge from

https://origsvn.digium.com/svn/asterisk/trunk

........
  r220365 | dvossel | 2009-09-24 15:37:20 -0500 (Thu, 24 Sep 2009) | 8 lines
  
  fixes tcptls_session memory leak caused by ref count error
  
  (closes issue #15939)
  Reported by: dvossel
  
  Review: https://reviewboard.asterisk.org/r/375/
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.6.0@220372 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
David Vossel
2009-09-24 20:42:35 +00:00
parent 670aa3b5f0
commit ee8f1f20a1

View File

@@ -276,7 +276,6 @@ struct ast_tcptls_session_instance *ast_tcptls_client_start(struct server_args *
__ssl_setup(desc->tls_cfg, 1);
}
ao2_ref(tcptls_session, +1);
if (!ast_make_file_from_fd(tcptls_session))
goto error;
@@ -374,6 +373,8 @@ void ast_tcptls_server_stop(struct server_args *desc)
* creates a FILE * from the fd passed by the accept thread.
* This operation is potentially expensive (certificate verification),
* so we do it in the child thread context.
*
* \note must decrement ref count before returning NULL on error
*/
void *ast_make_file_from_fd(void *data)
{
@@ -448,6 +449,7 @@ void *ast_make_file_from_fd(void *data)
if (peer)
X509_free(peer);
fclose(tcptls_session->f);
ao2_ref(tcptls_session, -1);
return NULL;
}
}