diff options
author | dvossel <dvossel@f38db490-d61c-443f-a65b-d21fe96a405b> | 2009-09-24 20:42:35 +0000 |
---|---|---|
committer | dvossel <dvossel@f38db490-d61c-443f-a65b-d21fe96a405b> | 2009-09-24 20:42:35 +0000 |
commit | a19cfc608977dfe09f838c8205e73c51926b3f89 (patch) | |
tree | 5616c1d981df5aa59b714adf8d91104147ae7c37 /main/tcptls.c | |
parent | b165c0a8daf60e5719e273005fd4012441caee43 (diff) |
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: http://svn.digium.com/svn/asterisk/branches/1.6.0@220372 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main/tcptls.c')
-rw-r--r-- | main/tcptls.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/main/tcptls.c b/main/tcptls.c index 64273ae0d..66a1abd65 100644 --- a/main/tcptls.c +++ b/main/tcptls.c @@ -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; } } |