diff options
author | Anton Khirnov <anton@khirnov.net> | 2013-11-29 20:20:20 +0100 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2013-12-09 08:44:34 +0100 |
commit | a1ee1648690726b34e98eaf8db04fd7b3303cfc8 (patch) | |
tree | a26fcbd441a7a9c8cfe135f4639756f49344bcdd /libavcodec | |
parent | 85f947aefb3dae81f65f518acdffa8e31c679654 (diff) | |
download | ffmpeg-a1ee1648690726b34e98eaf8db04fd7b3303cfc8.tar.gz |
lavc/decode_video(): always unref the frame if there is no output in decode_video
Not just on failure. This is the same thing that is done in the audio
path and should prevent leaks in decoders that allocate a frame, but
then end up not writing into it.
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/utils.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/libavcodec/utils.c b/libavcodec/utils.c index e9d6734017..899b6e15ee 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -1416,9 +1416,6 @@ int attribute_align_arg avcodec_decode_video2(AVCodecContext *avctx, AVFrame *pi emms_c(); //needed to avoid an emms_c() call before every return; - if (ret < 0 && picture->buf[0]) - av_frame_unref(picture); - if (*got_picture_ptr) { if (!avctx->refcounted_frames) { avci->to_free = *picture; @@ -1427,7 +1424,8 @@ int attribute_align_arg avcodec_decode_video2(AVCodecContext *avctx, AVFrame *pi } avctx->frame_number++; - } + } else + av_frame_unref(picture); } else ret = 0; |