ffmpeg | branch: master | Jack Lau <jacklau1...@qq.com> | Sat Jul 12 17:03:02 2025 +0800| [abb274b154a14aaed30e4226abe98246df5c6fc6] | committer: Timo Rothenpieler
avformat/tls_openssl: make tls and dtls use one close function Signed-off-by: Jack Lau <jacklau1...@qq.com> Signed-off-by: Timo Rothenpieler <t...@rothenpieler.org> > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=abb274b154a14aaed30e4226abe98246df5c6fc6 --- libavformat/tls_openssl.c | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/libavformat/tls_openssl.c b/libavformat/tls_openssl.c index 2a969b27f1..780867ab79 100644 --- a/libavformat/tls_openssl.c +++ b/libavformat/tls_openssl.c @@ -578,7 +578,8 @@ 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) + ffurl_closep(c->tls_shared.is_dtls ? &c->tls_shared.udp : &c->tls_shared.tcp); if (c->url_bio_method) BIO_meth_free(c->url_bio_method); return 0; @@ -908,19 +909,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); - return 0; -} - static int tls_open(URLContext *h, const char *uri, int flags, AVDictionary **options) { TLSContext *p = h->priv_data; @@ -1069,7 +1057,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, _______________________________________________ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".