mirror of
https://github.com/asterisk/asterisk.git
synced 2025-11-07 02:18:15 +00:00
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:
@@ -276,7 +276,6 @@ struct ast_tcptls_session_instance *ast_tcptls_client_start(struct server_args *
|
|||||||
__ssl_setup(desc->tls_cfg, 1);
|
__ssl_setup(desc->tls_cfg, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
ao2_ref(tcptls_session, +1);
|
|
||||||
if (!ast_make_file_from_fd(tcptls_session))
|
if (!ast_make_file_from_fd(tcptls_session))
|
||||||
goto error;
|
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.
|
* creates a FILE * from the fd passed by the accept thread.
|
||||||
* This operation is potentially expensive (certificate verification),
|
* This operation is potentially expensive (certificate verification),
|
||||||
* so we do it in the child thread context.
|
* 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)
|
void *ast_make_file_from_fd(void *data)
|
||||||
{
|
{
|
||||||
@@ -448,6 +449,7 @@ void *ast_make_file_from_fd(void *data)
|
|||||||
if (peer)
|
if (peer)
|
||||||
X509_free(peer);
|
X509_free(peer);
|
||||||
fclose(tcptls_session->f);
|
fclose(tcptls_session->f);
|
||||||
|
ao2_ref(tcptls_session, -1);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user