tcptls: NULL-check the parameter of ast_ssl_teardown before accessing it.

This avoids a crash on stopping a chan_sip which failed to start its TLS server.

ASTERISK-27339 #close

Change-Id: I327fc70db68eaaca5b50a15c7fd687fde79263d5
This commit is contained in:
Alexander Traud
2017-10-13 15:12:07 +02:00
parent 7215d07ca2
commit 114ed320ea

View File

@@ -1047,7 +1047,7 @@ int ast_ssl_setup(struct ast_tls_config *cfg)
void ast_ssl_teardown(struct ast_tls_config *cfg)
{
#ifdef DO_SSL
if (cfg->ssl_ctx) {
if (cfg && cfg->ssl_ctx) {
SSL_CTX_free(cfg->ssl_ctx);
cfg->ssl_ctx = NULL;
}