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>
(cherry picked from commit e09e2c6442924bfa1fb5efc419bc27fc6ef8a532)
This commit is contained in:
Andreas Rheinhardt 2020-09-07 18:41:51 +02:00
parent 4e7e2e1bd3
commit 753c0afe72

View File

@ -1867,10 +1867,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);
}