diff mbox series

[FFmpeg-devel,01/21] avformat/dashdec: Avoid double free on error

Message ID 20200919163610.1099233-1-andreas.rheinhardt@gmail.com
State Accepted
Commit e09e2c6442924bfa1fb5efc419bc27fc6ef8a532
Headers show
Series [FFmpeg-devel,01/21] avformat/dashdec: Avoid double free on error | expand

Checks

Context Check Description
andriy/default pending
andriy/make success Make finished
andriy/make_fate success Make fate finished

Commit Message

Andreas Rheinhardt Sept. 19, 2020, 4:35 p.m. UTC
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.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
---
 libavformat/dashdec.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
diff mbox series

Patch

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);
             }