Martin Storsjö <[email protected]> writes:

> ---
>  libavcodec/snow.c    |   10 ++++++++--
>  libavcodec/snowdec.c |    7 ++++++-
>  libavcodec/snowenc.c |    7 +++++--
>  3 files changed, 19 insertions(+), 5 deletions(-)
>
> diff --git a/libavcodec/snow.c b/libavcodec/snow.c
> index 821b81b..ee9c998 100644
> --- a/libavcodec/snow.c
> +++ b/libavcodec/snow.c
> @@ -394,7 +394,7 @@ mca( 8, 8,8)
>  av_cold int ff_snow_common_init(AVCodecContext *avctx){
>      SnowContext *s = avctx->priv_data;
>      int width, height;
> -    int i, j;
> +    int i, j, ret;
>
>      s->avctx= avctx;
>      s->max_ref_frames=1; //just make sure its not an invalid value in case 
> of no initial keyframe
> @@ -456,8 +456,14 @@ av_cold int ff_snow_common_init(AVCodecContext *avctx){
>          for(j=0; j<MAX_REF_FRAMES; j++)
>              ff_scale_mv_ref[i][j] = 256*(i+1)/(j+1);
>
> -    s->avctx->get_buffer(s->avctx, &s->mconly_picture);
> +    if ((ret = s->avctx->get_buffer(s->avctx, &s->mconly_picture)) < 0) {
> +        av_log(s->avctx, AV_LOG_ERROR, "get_buffer() failed\n");
> +        return ret;
> +    }
>      s->scratchbuf = av_malloc(s->mconly_picture.linesize[0]*7*MB_SIZE);
> +    if (!s->spatial_idwt_buffer || !s->spatial_dwt_buffer ||
> +        !s->temp_dwt_buffer || !s->temp_idwt_buffer || !s->scratchbuf)
> +        return AVERROR(ENOMEM);

FF_ALLOC_OR_GOTO?

-- 
Måns Rullgård
[email protected]
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to