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

Showing the changes to libavformat (1 of 1 file). Show all

Unified · Split

libavformat/tls_openssl.c+3−15
@@ -578,7 +578,8 @@ static int tls_close(URLContext *h) · 577 unmodified lines
578 }578 }
579 if (c->ctx)579 if (c->ctx)
580 SSL_CTX_free(c->ctx);580 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);
582 if (c->url_bio_method)583 if (c->url_bio_method)
583 BIO_meth_free(c->url_bio_method);584 BIO_meth_free(c->url_bio_method);
584 return 0;585 return 0;
@@ -908,19 +909,6 @@ fail: · 323 unmodified lines
908 return ret;909 return ret;
909}910}
910 911
911/**
912 * Cleanup the DTLS context.
913 */
914static 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
924static int tls_open(URLContext *h, const char *uri, int flags, AVDictionary **options)912static int tls_open(URLContext *h, const char *uri, int flags, AVDictionary **options)
925{913{
926 TLSContext *p = h->priv_data;914 TLSContext *p = h->priv_data;
@@ -1069,7 +1057,7 @@ const URLProtocol ff_dtls_protocol = { · 142 unmodified lines
1069 .name = "dtls",1057 .name = "dtls",
1070 .url_open2 = dtls_start,1058 .url_open2 = dtls_start,
1071 .url_handshake = dtls_handshake,1059 .url_handshake = dtls_handshake,
1072 .url_close = dtls_close,1060 .url_close = tls_close,
1073 .url_read = tls_read,1061 .url_read = tls_read,
1074 .url_write = tls_write,1062 .url_write = tls_write,
1075 .url_get_file_handle = tls_get_file_handle,1063 .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