[asterisk-commits] dvossel: branch 1.6.0 r220372 - in /branches/1.6.0: ./ main/tcptls.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Sep 24 15:42:39 CDT 2009


Author: dvossel
Date: Thu Sep 24 15:42:35 2009
New Revision: 220372

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=220372
Log:
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/
........

Modified:
    branches/1.6.0/   (props changed)
    branches/1.6.0/main/tcptls.c

Propchange: branches/1.6.0/
------------------------------------------------------------------------------
Binary property 'trunk-merged' - no diff available.

Modified: branches/1.6.0/main/tcptls.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.6.0/main/tcptls.c?view=diff&rev=220372&r1=220371&r2=220372
==============================================================================
--- branches/1.6.0/main/tcptls.c (original)
+++ branches/1.6.0/main/tcptls.c Thu Sep 24 15:42:35 2009
@@ -276,7 +276,6 @@
 		__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 @@
 * 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 @@
 						if (peer)
 							X509_free(peer);
 						fclose(tcptls_session->f);
+						ao2_ref(tcptls_session, -1);
 						return NULL;
 					}
 				}




More information about the asterisk-commits mailing list