diff options
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; |