avcodec/mpegvideo: Reset bitstream_buffer_size on allocation failure
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
parent
e5d1152ccc
commit
d860084c50
@ -2670,8 +2670,10 @@ int ff_mpeg4_frame_end(AVCodecContext *avctx, const uint8_t *buf, int buf_size)
|
||||
av_fast_padded_malloc(&s->bitstream_buffer,
|
||||
&s->allocated_bitstream_buffer_size,
|
||||
buf_size - current_pos);
|
||||
if (!s->bitstream_buffer)
|
||||
if (!s->bitstream_buffer) {
|
||||
s->bitstream_buffer_size = 0;
|
||||
return AVERROR(ENOMEM);
|
||||
}
|
||||
memcpy(s->bitstream_buffer, buf + current_pos,
|
||||
buf_size - current_pos);
|
||||
s->bitstream_buffer_size = buf_size - current_pos;
|
||||
|
@ -1049,8 +1049,10 @@ do {\
|
||||
av_fast_malloc(&s->bitstream_buffer,
|
||||
&s->allocated_bitstream_buffer_size,
|
||||
s1->allocated_bitstream_buffer_size);
|
||||
if (!s->bitstream_buffer)
|
||||
if (!s->bitstream_buffer) {
|
||||
s->bitstream_buffer_size = 0;
|
||||
return AVERROR(ENOMEM);
|
||||
}
|
||||
}
|
||||
s->bitstream_buffer_size = s1->bitstream_buffer_size;
|
||||
memcpy(s->bitstream_buffer, s1->bitstream_buffer,
|
||||
|
Loading…
x
Reference in New Issue
Block a user