[asterisk-commits] file: branch file/netsock2 r97636 - /team/file/netsock2/main/netsock2.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Wed Jan 9 15:55:49 CST 2008
Author: file
Date: Wed Jan 9 15:55:48 2008
New Revision: 97636
URL: http://svn.digium.com/view/asterisk?view=rev&rev=97636
Log:
Don't leak memory when freeing a socket list that contains TCP and TLS sockets.
Modified:
team/file/netsock2/main/netsock2.c
Modified: team/file/netsock2/main/netsock2.c
URL: http://svn.digium.com/view/asterisk/team/file/netsock2/main/netsock2.c?view=diff&rev=97636&r1=97635&r2=97636
==============================================================================
--- team/file/netsock2/main/netsock2.c (original)
+++ team/file/netsock2/main/netsock2.c Wed Jan 9 15:55:48 2008
@@ -276,11 +276,15 @@
pthread_join(child_thread, NULL);
}
AST_LIST_TRAVERSE_SAFE_END;
- } else {
- /* Other transports do not have their own thread so we can destroy them here */
- close(socket->fd);
- ast_free(socket);
+#ifdef HAVE_OPENSSL
+ /* If this is a TLS based transport free the SSL context that was created when it was bound */
+ if (socket->transport == AST_NETSOCK2_TRANSPORT_TLS)
+ SSL_CTX_free(socket->ssl_ctx);
+#endif
}
+ /* Simply close the socket's file descriptor and free it, we need not do more */
+ close(socket->fd);
+ ast_free(socket);
}
/* Drop the I/O context */
More information about the asterisk-commits
mailing list