summaryrefslogtreecommitdiff
path: root/libavformat/dashdec.c
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>2020-09-07 18:41:51 +0200
committerAndreas Rheinhardt <andreas.rheinhardt@gmail.com>2020-09-21 04:29:18 +0200
commite09e2c6442924bfa1fb5efc419bc27fc6ef8a532 (patch)
tree7ddbcdff9eb205a396bbd3b8a203c4879044d310 /libavformat/dashdec.c
parent6c8ff1838d1384609f865fc3074cb5cf65aa6ba8 (diff)
avformat/dashdec: Avoid double free on error
When using one of the AV_DICT_DONT_STRDUP_KEY/VAL flags, av_dict_set() already frees the key/value on error, so that freeing it again would lead to a double free. 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.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c
index 1e9985f32c..4048323c7d 100644
--- a/libavformat/dashdec.c
+++ b/libavformat/dashdec.c
@@ -1869,10 +1869,8 @@ static int save_avio_options(AVFormatContext *s)
if (av_opt_get(s->pb, *opt, AV_OPT_SEARCH_CHILDREN, &buf) >= 0) {
if (buf[0] != '\0') {
ret = av_dict_set(&c->avio_opts, *opt, buf, AV_DICT_DONT_STRDUP_VAL);
- if (ret < 0) {
- av_freep(&buf);
+ if (ret < 0)
return ret;
- }
} else {
av_freep(&buf);
}