Signed-off-by: Jack Lau <jacklau1...@qq.com> --- libavformat/tls_openssl.c | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 deletions(-)
diff --git a/libavformat/tls_openssl.c b/libavformat/tls_openssl.c index c824c5452b..3ed4585ecf 100644 --- a/libavformat/tls_openssl.c +++ b/libavformat/tls_openssl.c @@ -553,9 +553,16 @@ static int tls_close(URLContext *h) } if (c->ctx) SSL_CTX_free(c->ctx); - ffurl_closep(&c->tls_shared.tcp); + if (c->tls_shared.external_sock != 1) + ffurl_closep(c->tls_shared.is_dtls ? &c->tls_shared.udp : &c->tls_shared.tcp); + if (c->tls_shared.cert_buf) + av_freep(&c->tls_shared.cert_buf); + if (c->tls_shared.key_buf) + av_freep(&c->tls_shared.key_buf); if (c->url_bio_method) BIO_meth_free(c->url_bio_method); + if (c->pkey) + EVP_PKEY_free(c->pkey); return 0; } @@ -875,20 +882,6 @@ fail: return ret; } -/** - * Cleanup the DTLS context. - */ -static av_cold int dtls_close(URLContext *h) -{ - TLSContext *ctx = h->priv_data; - SSL_free(ctx->ssl); - SSL_CTX_free(ctx->ctx); - av_freep(&ctx->tls_shared.cert_buf); - av_freep(&ctx->tls_shared.key_buf); - EVP_PKEY_free(ctx->pkey); - return 0; -} - static int tls_open(URLContext *h, const char *uri, int flags, AVDictionary **options) { TLSContext *p = h->priv_data; @@ -1032,7 +1025,7 @@ const URLProtocol ff_dtls_protocol = { .name = "dtls", .url_open2 = dtls_start, .url_handshake = dtls_handshake, - .url_close = dtls_close, + .url_close = tls_close, .url_read = tls_read, .url_write = tls_write, .url_get_file_handle = tls_get_file_handle, -- 2.49.0 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".