1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-08-04 22:03:09 +02:00

fftools/textformat/avtextformat: Fix segfault upon allocation error

Reviewed-by: softworkz . <softworkz-at-hotmail.com@ffmpeg.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
Andreas Rheinhardt
2025-04-15 01:45:54 +02:00
parent b9450583bc
commit 7ee7632cb8

View File

@ -590,10 +590,12 @@ int avtextwriter_context_close(AVTextWriterContext **pwctx)
if (!wctx) if (!wctx)
return EINVAL; return EINVAL;
if (wctx->writer) {
if (wctx->writer->uninit) if (wctx->writer->uninit)
wctx->writer->uninit(wctx); wctx->writer->uninit(wctx);
if (wctx->writer->priv_class) if (wctx->writer->priv_class)
av_opt_free(wctx->priv); av_opt_free(wctx->priv);
}
av_freep(&wctx->priv); av_freep(&wctx->priv);
av_freep(pwctx); av_freep(pwctx);
return ret; return ret;