Commit 96b495f4 authored by Michael Niedermayer's avatar Michael Niedermayer

Merge commit 'e570f895'

* commit 'e570f895':
  libschroedinger: Check memory allocations

Conflicts:
	libavcodec/libschroedinger.c
Merged-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parents 0425e16d e570f895
...@@ -267,6 +267,8 @@ static int libschroedinger_decode_frame(AVCodecContext *avctx, ...@@ -267,6 +267,8 @@ static int libschroedinger_decode_frame(AVCodecContext *avctx,
/* Decoder needs a frame - create one and push it in. */ /* Decoder needs a frame - create one and push it in. */
frame = ff_create_schro_frame(avctx, frame = ff_create_schro_frame(avctx,
p_schro_params->frame_format); p_schro_params->frame_format);
if (!frame)
return AVERROR(ENOMEM);
schro_decoder_add_output_picture(decoder, frame); schro_decoder_add_output_picture(decoder, frame);
break; break;
......
...@@ -284,6 +284,8 @@ static int libschroedinger_encode_frame(AVCodecContext *avctx, AVPacket *pkt, ...@@ -284,6 +284,8 @@ static int libschroedinger_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
} else { } else {
/* Allocate frame data to schro input buffer. */ /* Allocate frame data to schro input buffer. */
SchroFrame *in_frame = libschroedinger_frame_from_data(avctx, frame); SchroFrame *in_frame = libschroedinger_frame_from_data(avctx, frame);
if (!in_frame)
return AVERROR(ENOMEM);
/* Load next frame. */ /* Load next frame. */
schro_encoder_push_frame(encoder, in_frame); schro_encoder_push_frame(encoder, in_frame);
} }
...@@ -332,6 +334,8 @@ static int libschroedinger_encode_frame(AVCodecContext *avctx, AVPacket *pkt, ...@@ -332,6 +334,8 @@ static int libschroedinger_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
/* Create output frame. */ /* Create output frame. */
p_frame_output = av_mallocz(sizeof(FFSchroEncodedFrame)); p_frame_output = av_mallocz(sizeof(FFSchroEncodedFrame));
if (!p_frame_output)
return AVERROR(ENOMEM);
/* Set output data. */ /* Set output data. */
p_frame_output->size = p_schro_params->enc_buf_size; p_frame_output->size = p_schro_params->enc_buf_size;
p_frame_output->p_encbuf = p_schro_params->enc_buf; p_frame_output->p_encbuf = p_schro_params->enc_buf;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment