[FFmpeg-cvslog] avformat/imf: fix bad free() when directory name of the input url is empty

Pierre-Anthony Lemieux git at videolan.org
Wed Jan 5 13:22:27 EET 2022


ffmpeg | branch: master | Pierre-Anthony Lemieux <pal at palemieux.com> | Mon Jan  3 07:59:19 2022 -0800| [59f1a46048109b8ec9f953d0d9348f9f1ae2a8c2] | committer: Zane van Iperen

avformat/imf: fix bad free() when directory name of the input url is empty

Signed-off-by: Pierre-Anthony Lemieux <pal at palemieux.com>
Signed-off-by: Zane van Iperen <zane at zanevaniperen.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=59f1a46048109b8ec9f953d0d9348f9f1ae2a8c2
---

 libavformat/imfdec.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/libavformat/imfdec.c b/libavformat/imfdec.c
index 503c8a2659..023f3556f6 100644
--- a/libavformat/imfdec.c
+++ b/libavformat/imfdec.c
@@ -624,8 +624,11 @@ static int imf_read_header(AVFormatContext *s)
     tmp_str = av_strdup(s->url);
     if (!tmp_str)
         return AVERROR(ENOMEM);
+    c->base_url = av_strdup(av_dirname(tmp_str));
+    av_freep(&tmp_str);
+    if (!c->base_url)
+        return AVERROR(ENOMEM);
 
-    c->base_url = av_dirname(tmp_str);
     if ((ret = ffio_copy_url_options(s->pb, &c->avio_opts)) < 0)
         return ret;
 



More information about the ffmpeg-cvslog mailing list