History

avformat/tls_openssl: make tls and dtls use one close function

Jack Lau committed 1 year ago

Commit abb274b1 parent bc8d06d1 file · +3 −15Browse files

Unified · Split

libavformat/tls_openssl.c+3−15
@@ -578,7 +578,8 @@ static int tls_close(URLContext *h) · 577 unmodified lines
578578 }
579579 if (c->ctx)
580580 SSL_CTX_free(c->ctx);
581− ffurl_closep(&c->tls_shared.tcp);
581+ if (!c->tls_shared.external_sock)
582+ ffurl_closep(c->tls_shared.is_dtls ? &c->tls_shared.udp : &c->tls_shared.tcp);
582583 if (c->url_bio_method)
583584 BIO_meth_free(c->url_bio_method);
584585 return 0;
@@ -908,19 +909,6 @@ fail: · 323 unmodified lines
908909 return ret;
909910 }
910911
911−/**
912− * Cleanup the DTLS context.
913− */
914−static av_cold int dtls_close(URLContext *h)
915−{
916− TLSContext *ctx = h->priv_data;
917− SSL_free(ctx->ssl);
918− SSL_CTX_free(ctx->ctx);
919− av_freep(&ctx->tls_shared.cert_buf);
920− av_freep(&ctx->tls_shared.key_buf);
921− return 0;
922−}
923−
924912 static int tls_open(URLContext *h, const char *uri, int flags, AVDictionary **options)
925913 {
926914 TLSContext *p = h->priv_data;
@@ -1069,7 +1057,7 @@ const URLProtocol ff_dtls_protocol = { · 142 unmodified lines
10691057 .name = "dtls",
10701058 .url_open2 = dtls_start,
10711059 .url_handshake = dtls_handshake,
1072− .url_close = dtls_close,
1060+ .url_close = tls_close,
10731061 .url_read = tls_read,
10741062 .url_write = tls_write,
10751063 .url_get_file_handle = tls_get_file_handle,

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t