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.
emms_c(); //needed to avoid an emms_c() call before every return;
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;
if (*got_picture_ptr) {
if (!avctx->refcounted_frames) {
avci->to_free = *picture;
+ } else
+ av_frame_unref(picture);