[FFmpeg-devel] [PATCH 2/5] decode: avoid leaks on failure in ff_get_buffer()

James Almer jamrial at gmail.com
Mon Oct 30 02:30:51 EET 2017


On 10/13/2017 1:59 PM, wm4 wrote:
> From: Anton Khirnov <anton at khirnov.net>
> 
> If the get_buffer() call fails, the frame might have some side data
> already set. Make sure it gets freed.
> 
> CC: libav-stable at libav.org
> 
> Merges Libav commit de77671438c24ffea93398c8dc885d4dd04477de.
> ---
>  libavcodec/decode.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/libavcodec/decode.c b/libavcodec/decode.c
> index 1337ffb527..437b848248 100644
> --- a/libavcodec/decode.c
> +++ b/libavcodec/decode.c
> @@ -1658,6 +1658,9 @@ end:
>          frame->height = avctx->height;
>      }
>  
> +    if (ret < 0)
> +        av_frame_unref(frame);
> +
>      return ret;
>  }

Applied as well.


More information about the ffmpeg-devel mailing list