ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinha...@outlook.com> | 
Tue Apr 15 01:45:54 2025 +0200| [7ee7632cb846c31b59f4e563790586fe97edf88a] | 
committer: Andreas Rheinhardt

fftools/textformat/avtextformat: Fix segfault upon allocation error

Reviewed-by: softworkz . <softworkz-at-hotmail....@ffmpeg.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinha...@outlook.com>

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

 fftools/textformat/avtextformat.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/fftools/textformat/avtextformat.c 
b/fftools/textformat/avtextformat.c
index c1b5eefab4..7edf7901e4 100644
--- a/fftools/textformat/avtextformat.c
+++ b/fftools/textformat/avtextformat.c
@@ -590,10 +590,12 @@ int avtextwriter_context_close(AVTextWriterContext 
**pwctx)
     if (!wctx)
         return EINVAL;
 
-    if (wctx->writer->uninit)
-        wctx->writer->uninit(wctx);
-    if (wctx->writer->priv_class)
-        av_opt_free(wctx->priv);
+    if (wctx->writer) {
+        if (wctx->writer->uninit)
+            wctx->writer->uninit(wctx);
+        if (wctx->writer->priv_class)
+            av_opt_free(wctx->priv);
+    }
     av_freep(&wctx->priv);
     av_freep(pwctx);
     return ret;

_______________________________________________
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to