summaryrefslogtreecommitdiffstats
path: root/libmpcodecs
diff options
context:
space:
mode:
authorreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2006-12-06 10:41:34 +0000
committerreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2006-12-06 10:41:34 +0000
commit10021f03bc9d2b3b2346cbb3cf5b0dcc747c1d24 (patch)
tree75333426420d4e778c6818d029431a0ceb0a16b1 /libmpcodecs
parente70b5d85000f39544958d569cf30c90291d168db (diff)
downloadmpv-10021f03bc9d2b3b2346cbb3cf5b0dcc747c1d24.tar.bz2
mpv-10021f03bc9d2b3b2346cbb3cf5b0dcc747c1d24.tar.xz
Fix memleak if vd_ffmpeg init fails
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@21514 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libmpcodecs')
-rw-r--r--libmpcodecs/vd_ffmpeg.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/libmpcodecs/vd_ffmpeg.c b/libmpcodecs/vd_ffmpeg.c
index 3f66d2e81e..f94bd31f18 100644
--- a/libmpcodecs/vd_ffmpeg.c
+++ b/libmpcodecs/vd_ffmpeg.c
@@ -242,6 +242,7 @@ static int init(sh_video_t *sh){
lavc_codec = (AVCodec *)avcodec_find_decoder_by_name(sh->codec->dll);
if(!lavc_codec){
mp_msg(MSGT_DECVIDEO,MSGL_ERR,MSGTR_MissingLAVCcodec,sh->codec->dll);
+ uninit(sh);
return 0;
}
@@ -406,6 +407,7 @@ static int init(sh_video_t *sh){
/* open it */
if (avcodec_open(avctx, lavc_codec) < 0) {
mp_msg(MSGT_DECVIDEO,MSGL_ERR, MSGTR_CantOpenCodec);
+ uninit(sh);
return 0;
}
mp_msg(MSGT_DECVIDEO,MSGL_V,"INFO: libavcodec init OK!\n");
@@ -429,7 +431,7 @@ static void uninit(sh_video_t *sh){
);
}
- if (avcodec_close(avctx) < 0)
+ if (avctx && avctx->codec && avcodec_close(avctx) < 0)
mp_msg(MSGT_DECVIDEO,MSGL_ERR, MSGTR_CantCloseCodec);
av_freep(&avctx->extradata);