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/libtheoraenc.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/libtheoraenc.c')
-rw-r--r-- | libavcodec/libtheoraenc.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/libavcodec/libtheoraenc.c b/libavcodec/libtheoraenc.c index 9041a27df0..75b0a168ed 100644 --- a/libavcodec/libtheoraenc.c +++ b/libavcodec/libtheoraenc.c @@ -58,8 +58,8 @@ static int concatenate_packet(unsigned int* offset, const ogg_packet* packet) { const char* message = NULL; - uint8_t* newdata = NULL; int newsize = avc_context->extradata_size + 2 + packet->bytes; + int err = AVERROR_INVALIDDATA; if (packet->bytes < 0) { message = "ogg_packet has negative size"; @@ -68,16 +68,16 @@ static int concatenate_packet(unsigned int* offset, } else if (newsize < avc_context->extradata_size) { message = "extradata_size would overflow"; } else { - newdata = av_realloc(avc_context->extradata, newsize); - if (!newdata) + if ((err = av_reallocp(&avc_context->extradata, newsize)) < 0) { + avc_context->extradata_size = 0; message = "av_realloc failed"; + } } if (message) { av_log(avc_context, AV_LOG_ERROR, "concatenate_packet failed: %s\n", message); - return -1; + return err; } - avc_context->extradata = newdata; avc_context->extradata_size = newsize; AV_WB16(avc_context->extradata + (*offset), packet->bytes); *offset += 2; |