aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/hls.c
diff options
context:
space:
mode:
authorJun Zhao <barryjzhao@tencent.com>2019-09-13 19:53:37 +0800
committerSteven Liu <lq@chinaffmpeg.org>2019-09-14 10:02:00 +0800
commit0c5726a332734d18821e03779f94d1af8e251641 (patch)
tree4cdb8e23d33d9878db2e0c922150db28e5ab7841 /libavformat/hls.c
parent90a5bebd19ea025044f73edfa9984e7bc964a5eb (diff)
downloadffmpeg-0c5726a332734d18821e03779f94d1af8e251641.tar.gz
lavf/hls: fix memory leak in error handling path for option tmp
fix memory leak in error handling path for option tmp. Reviewed-by: Steven Liu <lq@onvideo.cn> Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
Diffstat (limited to 'libavformat/hls.c')
-rw-r--r--libavformat/hls.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/libavformat/hls.c b/libavformat/hls.c
index bb07dcb96c..0611ddc6bb 100644
--- a/libavformat/hls.c
+++ b/libavformat/hls.c
@@ -620,9 +620,6 @@ static int open_url(AVFormatContext *s, AVIOContext **pb, const char *url,
int ret;
int is_http = 0;
- 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);
@@ -655,9 +652,13 @@ static int open_url(AVFormatContext *s, AVIOContext **pb, const char *url,
else if (strcmp(proto_name, "file") || !strncmp(url, "file,", 5))
return AVERROR_INVALIDDATA;
+ av_dict_copy(&tmp, opts, 0);
+ av_dict_copy(&tmp, opts2, 0);
+
if (is_http && c->http_persistent && *pb) {
ret = open_url_keepalive(c->ctx, pb, url);
if (ret == AVERROR_EXIT) {
+ av_dict_free(&tmp);
return ret;
} else if (ret < 0) {
if (ret != AVERROR_EOF)