[FFmpeg-devel] [PATCH] v210enc: check return value of avcodec_alloc_frame()

Reimar Döffinger Reimar.Doeffinger at gmx.de
Sat Jan 28 21:47:38 CET 2012


On Sat, Jan 28, 2012 at 08:27:17PM +0000, Paul B Mahol wrote:
> 
> Signed-off-by: Paul B Mahol <onemda at gmail.com>
> ---
>  libavcodec/v210enc.c |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
> 
> diff --git a/libavcodec/v210enc.c b/libavcodec/v210enc.c
> index 1a78aa2..947797d 100644
> --- a/libavcodec/v210enc.c
> +++ b/libavcodec/v210enc.c
> @@ -41,8 +41,9 @@ static av_cold int encode_init(AVCodecContext *avctx)
>                 avctx->bits_per_raw_sample);
>  
>      avctx->coded_frame = avcodec_alloc_frame();
> +    if (!avctx->coded_frame)
> +        return AVERROR(ENOMEM);
>  
> -    avctx->coded_frame->key_frame = 1;

I don't mind merging since it's so trivial, but please never leave
such things out from the commit message.


More information about the ffmpeg-devel mailing list