On Thu, 16 Feb 2017 10:29:37 -0800
Aman Gupta <ffm...@tmm1.net> wrote:

> From: Aman Gupta <a...@tmm1.net>
> 
> ---
>  libavcodec/videotoolbox.c | 15 ++++++++-------
>  1 file changed, 8 insertions(+), 7 deletions(-)
> 
> diff --git a/libavcodec/videotoolbox.c b/libavcodec/videotoolbox.c
> index 1288aa5..9be7bee 100644
> --- a/libavcodec/videotoolbox.c
> +++ b/libavcodec/videotoolbox.c
> @@ -590,15 +590,16 @@ static int videotoolbox_default_init(AVCodecContext 
> *avctx)
>  static void videotoolbox_default_free(AVCodecContext *avctx)
>  {
>      AVVideotoolboxContext *videotoolbox = avctx->hwaccel_context;
> +    if (!videotoolbox)
> +        return;
>  
> -    if (videotoolbox) {
> -        if (videotoolbox->cm_fmt_desc)
> -            CFRelease(videotoolbox->cm_fmt_desc);
> +    if (videotoolbox->cm_fmt_desc)
> +        CFRelease(videotoolbox->cm_fmt_desc);
>  
> -        if (videotoolbox->session) {
> -            VTDecompressionSessionInvalidate(videotoolbox->session);
> -            CFRelease(videotoolbox->session);
> -        }
> +    if (videotoolbox->session) {
> +        VTDecompressionSessionInvalidate(videotoolbox->session);
> +        CFRelease(videotoolbox->session);
> +        videotoolbox->session = NULL;
>      }
>  }
>  

LGTM
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

Reply via email to