Message ID | 20170216182938.55393-2-ffmpeg@tmm1.net |
---|---|
State | New |
Headers | show |
On Thu, 16 Feb 2017 10:29:37 -0800 Aman Gupta <ffmpeg@tmm1.net> wrote: > From: Aman Gupta <aman@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
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; } }
From: Aman Gupta <aman@tmm1.net> --- libavcodec/videotoolbox.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-)