diff options
author | Alexandra Khirnova <alexandra.khirnova@gmail.com> | 2013-12-06 13:44:17 +0100 |
---|---|---|
committer | Martin Storsjö <martin@martin.st> | 2013-12-09 12:27:51 +0200 |
commit | 9b8d11a76ae7bca8bbb58abb822138f8b42c776c (patch) | |
tree | 702aed7eb0e0684c7a91fdac06a9981fb4333c49 /libavcodec/libschroedingerenc.c | |
parent | d4f1188d1a662fed5347e70016da49e01563e8a8 (diff) | |
download | ffmpeg-9b8d11a76ae7bca8bbb58abb822138f8b42c776c.tar.gz |
avcodec: Use av_reallocp where suitable
Signed-off-by: Martin Storsjö <martin@martin.st>
Diffstat (limited to 'libavcodec/libschroedingerenc.c')
-rw-r--r-- | libavcodec/libschroedingerenc.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/libavcodec/libschroedingerenc.c b/libavcodec/libschroedingerenc.c index d53d846a43..3dc1481893 100644 --- a/libavcodec/libschroedingerenc.c +++ b/libavcodec/libschroedingerenc.c @@ -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); |