diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2013-12-09 20:31:29 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2013-12-09 20:31:29 +0100 |
commit | 8c677a9f06c5d145da0301cdc3c6bff9ebacb5d7 (patch) | |
tree | 9c756ade47cc06771cb120f53b5f9c22724717f6 /libavcodec/libtheoraenc.c | |
parent | 94a849b8b6c3e4a90361485b2e12a9a5c35833a3 (diff) | |
parent | 9b8d11a76ae7bca8bbb58abb822138f8b42c776c (diff) | |
download | ffmpeg-8c677a9f06c5d145da0301cdc3c6bff9ebacb5d7.tar.gz |
Merge commit '9b8d11a76ae7bca8bbb58abb822138f8b42c776c'
* commit '9b8d11a76ae7bca8bbb58abb822138f8b42c776c':
avcodec: Use av_reallocp where suitable
Conflicts:
libavcodec/bitstream.c
libavcodec/eatgv.c
libavcodec/flashsv.c
libavcodec/libtheoraenc.c
libavcodec/libvpxenc.c
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/libtheoraenc.c')
-rw-r--r-- | libavcodec/libtheoraenc.c | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/libavcodec/libtheoraenc.c b/libavcodec/libtheoraenc.c index 5d27c6364f..4c90822439 100644 --- a/libavcodec/libtheoraenc.c +++ b/libavcodec/libtheoraenc.c @@ -58,31 +58,26 @@ 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 ret; + int err = AVERROR_INVALIDDATA; if (packet->bytes < 0) { message = "ogg_packet has negative size"; - ret = AVERROR_INVALIDDATA; } else if (packet->bytes > 0xffff) { message = "ogg_packet is larger than 65535 bytes"; - ret = AVERROR_INVALIDDATA; } else if (newsize < avc_context->extradata_size) { message = "extradata_size would overflow"; - ret = AVERROR_INVALIDDATA; } 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"; - ret = AVERROR(ENOMEM); + } } if (message) { av_log(avc_context, AV_LOG_ERROR, "concatenate_packet failed: %s\n", message); - return ret; + return err; } - avc_context->extradata = newdata; avc_context->extradata_size = newsize; AV_WB16(avc_context->extradata + (*offset), packet->bytes); *offset += 2; |