avcodec: Use av_reallocp where suitable

Signed-off-by: Martin Storsjö <martin@martin.st>
This commit is contained in:
Alexandra Khirnova 2013-12-06 13:44:17 +01:00 committed by Martin Storsjö
parent d4f1188d1a
commit 9b8d11a76a
10 changed files with 73 additions and 76 deletions

View file

@ -292,6 +292,7 @@ static int libschroedinger_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
/* Now check to see if we have any output from the encoder. */
while (go) {
int err;
SchroStateEnum state;
state = schro_encoder_wait(encoder);
switch (state) {
@ -306,8 +307,12 @@ static int libschroedinger_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
* be able to set the pts correctly. So we don't write data
* to the frame output queue until we actually have a frame
*/
p_schro_params->enc_buf = av_realloc(p_schro_params->enc_buf,
p_schro_params->enc_buf_size + enc_buf->length);
if ((err = av_reallocp(&p_schro_params->enc_buf,
p_schro_params->enc_buf_size +
enc_buf->length)) < 0) {
p_schro_params->enc_buf_size = 0;
return err;
}
memcpy(p_schro_params->enc_buf + p_schro_params->enc_buf_size,
enc_buf->data, enc_buf->length);