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>
This commit is contained in:
Pierre-Anthony Lemieux 2022-01-03 07:59:19 -08:00 committed by Zane van Iperen
parent c1b55cb70c
commit 59f1a46048
No known key found for this signature in database
GPG Key ID: 68616B2D8AC4DCC5

View File

@ -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;