[FFmpeg-cvslog] lavfi/select: make sure avctx is set before closing it.

Clément Bœsch git at videolan.org
Tue Sep 18 18:49:25 CEST 2012


ffmpeg | branch: master | Clément Bœsch <ubitux at gmail.com> | Tue Sep 18 18:49:09 2012 +0200| [b89c16e73eef30b7ce95bd455d9b419b383d9409] | committer: Clément Bœsch

lavfi/select: make sure avctx is set before closing it.

This avoid a crash when the filter fails before config_input(),
typically with a syntax error in the next filter:
    select=gt(scene\,.4),select=fail

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

 libavfilter/vf_select.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/libavfilter/vf_select.c b/libavfilter/vf_select.c
index d47876b..72af50e 100644
--- a/libavfilter/vf_select.c
+++ b/libavfilter/vf_select.c
@@ -383,8 +383,10 @@ static av_cold void uninit(AVFilterContext *ctx)
 
     if (select->do_scene_detect) {
         avfilter_unref_bufferp(&select->prev_picref);
-        avcodec_close(select->avctx);
-        av_freep(&select->avctx);
+        if (select->avctx) {
+            avcodec_close(select->avctx);
+            av_freep(&select->avctx);
+        }
     }
 }
 



More information about the ffmpeg-cvslog mailing list