]> git.sesse.net Git - ffmpeg/commitdiff
avformat/dashdec: Avoid double free on error
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Mon, 7 Sep 2020 16:41:51 +0000 (18:41 +0200)
committerAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Mon, 21 Sep 2020 02:29:18 +0000 (04:29 +0200)
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>
libavformat/dashdec.c

index 1e9985f32cd2deeceac04edabf9df22996bd3380..4048323c7ddcabf2bef1f97f5ca9ee9ef21d0f55 100644 (file)
@@ -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);
             }