aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPierre-Anthony Lemieux <pal@palemieux.com>2022-01-03 07:59:19 -0800
committerZane van Iperen <zane@zanevaniperen.com>2022-01-05 21:23:26 +1000
commit2186555bc9834c16607ee87c1015e8a78bd4ea56 (patch)
treeabb3341fb5785caf5836e90d84c31380bbd3f49a
parent5fd7b8e9b2cceae865ffd425a7895cccc76c0dba (diff)
downloadffmpeg-2186555bc9834c16607ee87c1015e8a78bd4ea56.tar.gz
avformat/imf: fix bad free() when directory name of the input url is empty
Signed-off-by: Pierre-Anthony Lemieux <pal@palemieux.com> Signed-off-by: Zane van Iperen <zane@zanevaniperen.com> (cherry picked from commit 59f1a46048109b8ec9f953d0d9348f9f1ae2a8c2)
-rw-r--r--libavformat/imfdec.c5
1 files changed, 4 insertions, 1 deletions
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;