[FFmpeg-devel] [PATCH 2/2] fix bug: select filter uninit failed when init return error

Stefano Sabatini stefano.sabatini-lala at poste.it
Thu Aug 11 16:12:12 CEST 2011


On date Thursday 2011-08-11 18:15:29 +0800, William Yu encoded:
> ---
>  libavfilter/vf_select.c |   17 +++++++++++------
>  1 files changed, 11 insertions(+), 6 deletions(-)

> diff --git a/libavfilter/vf_select.c b/libavfilter/vf_select.c
> index fe6bb4b..cda2ef2 100644
> --- a/libavfilter/vf_select.c
> +++ b/libavfilter/vf_select.c
> @@ -319,14 +319,19 @@ static av_cold void uninit(AVFilterContext *ctx)
>      AVFilterBufferRef *picref;
>      int i;
>  
> -    av_expr_free(select->expr);
> -    select->expr = NULL;
> +    if(select->expr) {
> +        av_expr_free(select->expr);
> +        select->expr = NULL;
> +    }
>  
> -    for (i = 0; i < av_fifo_size(select->pending_frames)/sizeof(picref); i++) {
> -        av_fifo_generic_read(select->pending_frames, &picref, sizeof(picref), NULL);
> -        avfilter_unref_buffer(picref);
> +    if(select->pending_frames) {
> +        for (i = 0; i < av_fifo_size(select->pending_frames)/sizeof(picref); i++) {
> +            av_fifo_generic_read(select->pending_frames, &picref, sizeof(picref), NULL);
> +            avfilter_unref_buffer(picref);
> +        }
> +        av_fifo_free(select->pending_frames);
> +        select->pending_frames = NULL;
>      }
> -    av_fifo_free(select->pending_frames);
>  }
>  
>  AVFilter avfilter_vf_select = {

Applied, thanks.
-- 
FFmpeg = Free and Fast Mastering Philosofic Evil Gangster


More information about the ffmpeg-devel mailing list