diff options
author | kjeyapal@akamai.com | 2018-11-16 14:27:11 +0530 |
---|---|---|
committer | Karthick J | 2018-11-22 12:06:27 +0530 |
commit | 4903662a1da95ca8b9b720ae00508e26fbc84f9c (patch) | |
tree | e73a2035bc9b6f68d2f37b14686d62de1daf0ffa /libavformat | |
parent | 3913d6f7348482d0ad914cb35e74b29b1385d9bd (diff) |
avformat/dashenc : Handled error from ff_http_do_new_request() cleanly
Diffstat (limited to 'libavformat')
-rw-r--r-- | libavformat/dashenc.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c index 2c872f93a1..e51ffaf31b 100644 --- a/libavformat/dashenc.c +++ b/libavformat/dashenc.c @@ -174,6 +174,8 @@ static int dashenc_io_open(AVFormatContext *s, AVIOContext **pb, char *filename, URLContext *http_url_context = ffio_geturlcontext(*pb); av_assert0(http_url_context); err = ff_http_do_new_request(http_url_context, filename); + if (err < 0) + ff_format_io_close(s, pb); #endif } return err; @@ -183,6 +185,9 @@ static void dashenc_io_close(AVFormatContext *s, AVIOContext **pb, char *filenam DASHContext *c = s->priv_data; int http_base_proto = filename ? ff_is_http_proto(filename) : 0; + if (!*pb) + return; + if (!http_base_proto || !c->http_persistent) { ff_format_io_close(s, pb); #if CONFIG_HTTP_PROTOCOL @@ -356,7 +361,8 @@ static int flush_dynbuf(OutputStream *os, int *range_length) // write out to file *range_length = avio_close_dyn_buf(os->ctx->pb, &buffer); os->ctx->pb = NULL; - avio_write(os->out, buffer + os->written_len, *range_length - os->written_len); + if (os->out) + avio_write(os->out, buffer + os->written_len, *range_length - os->written_len); os->written_len = 0; av_free(buffer); |