avcodec/libtheoraenc: Check for av_fast_realloc() failure

Fixes CID1257799
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
pull/113/head^2
Michael Niedermayer 10 years ago
parent 27216bf314
commit 67d4d5f5db
  1. 5
      libavcodec/libtheoraenc.c

@ -99,8 +99,11 @@ static int get_stats(AVCodecContext *avctx, int eos)
return AVERROR_EXTERNAL;
}
if (!eos) {
h->stats = av_fast_realloc(h->stats, &h->stats_size,
void *tmp = av_fast_realloc(h->stats, &h->stats_size,
h->stats_offset + bytes);
if (!tmp)
return AVERROR(ENOMEM);
h->stats = tmp;
memcpy(h->stats + h->stats_offset, buf, bytes);
h->stats_offset += bytes;
} else {

Loading…
Cancel
Save