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;