summaryrefslogtreecommitdiff
path: root/libavformat/dashdec.c
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>2020-09-07 20:36:25 +0200
committerAndreas Rheinhardt <andreas.rheinhardt@gmail.com>2020-09-21 04:31:40 +0200
commit4b8fdf70a87b9d3d60f4c78bd9a5c294f524032c (patch)
tree499b55c13f446912fb443f0153d92f323bed1c86 /libavformat/dashdec.c
parenteb344862e4a5493900d2120952f95fb26805350c (diff)
avformat/dashdec: Fix leak of AVDictionary on error
Just postpone the allocation of the dict until it is really needed (after the checks that can fail). Reviewed-by: Steven Liu <lq@chinaffmpeg.org> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Diffstat (limited to 'libavformat/dashdec.c')
-rw-r--r--libavformat/dashdec.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c
index 3b83075e7a..ee40f2aa0c 100644
--- a/libavformat/dashdec.c
+++ b/libavformat/dashdec.c
@@ -407,9 +407,6 @@ static int open_url(AVFormatContext *s, AVIOContext **pb, const char *url,
const char *proto_name = NULL;
int ret;
- av_dict_copy(&tmp, opts, 0);
- av_dict_copy(&tmp, opts2, 0);
-
if (av_strstart(url, "crypto", NULL)) {
if (url[6] == '+' || url[6] == ':')
proto_name = avio_find_protocol_name(url + 7);
@@ -443,6 +440,8 @@ static int open_url(AVFormatContext *s, AVIOContext **pb, const char *url,
return AVERROR_INVALIDDATA;
av_freep(pb);
+ av_dict_copy(&tmp, opts, 0);
+ av_dict_copy(&tmp, opts2, 0);
ret = avio_open2(pb, url, AVIO_FLAG_READ, c->interrupt_callback, &tmp);
if (ret >= 0) {
// update cookies on http response with setcookies.