From 77a670e7967ec16d9acf43248bb2d035acadb8c5 Mon Sep 17 00:00:00 2001 From: Craig Thomasson Date: Tue, 6 Apr 2010 09:52:41 +0000 Subject: [PATCH] Fix segfault when encoder initialization fails. Patch by Craig Thomasson $(name) dot $(surname) ripcode com Originally committed as revision 22811 to svn://svn.ffmpeg.org/ffmpeg/trunk --- libavcodec/utils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/utils.c b/libavcodec/utils.c index 52aa672541..8b4b363af4 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -710,7 +710,7 @@ av_cold int avcodec_close(AVCodecContext *avctx) avctx->codec->close(avctx); avcodec_default_free_buffers(avctx); av_freep(&avctx->priv_data); - if(avctx->codec->encode) + if(avctx->codec && avctx->codec->encode) av_freep(&avctx->extradata); avctx->codec = NULL; entangled_thread_counter--;