In the single-file branch of dash_init(), ctx->url was assigned the result
of av_strdup() without a NULL check, unlike the other string duplications in
the same function. On allocation failure ctx->url was left NULL and handed
to the child muxer. Check it and return AVERROR(ENOMEM), freeing opts on the
error path.

Signed-off-by: Anas Khan <[email protected]>
---
 libavformat/dashenc.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
index 406ee2cf0d..d089ca4411 100644
--- a/libavformat/dashenc.c
+++ b/libavformat/dashenc.c
@@ -1468,6 +1468,10 @@ static int dash_init(AVFormatContext *s)
             ret = s->io_open(s, &os->out, filename, AVIO_FLAG_WRITE, &opts);
         } else {
             ctx->url = av_strdup(filename);
+            if (!ctx->url) {
+                av_dict_free(&opts);
+                return AVERROR(ENOMEM);
+            }
             ret = s->io_open(s, &ctx->pb, filename, AVIO_FLAG_WRITE, &opts);
         }
         av_dict_free(&opts);
-- 
2.54.0

_______________________________________________
ffmpeg-devel mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to