Index: libavcodec/utils.c |
diff --git a/libavcodec/utils.c b/libavcodec/utils.c |
index 9e31d9ede0be0dc8b5636c81d9e0e9af54caccdf..72e25dc93521c8ec1f5f6af1c0f629b1dfe9b0f4 100644 |
--- a/libavcodec/utils.c |
+++ b/libavcodec/utils.c |
@@ -874,6 +874,8 @@ int attribute_align_arg avcodec_open2(AVCodecContext *avctx, AVCodec *codec, AVD |
if(avctx->codec->init && !(avctx->active_thread_type&FF_THREAD_FRAME)){ |
ret = avctx->codec->init(avctx); |
if (ret < 0) { |
+ if(avctx->codec->close) |
+ avctx->codec->close(avctx); |
goto free_and_end; |
} |
} |