comparison h263dec.c @ 9415:141badec76fc libavcodec

Add a av_fast_malloc function and replace several uses of av_fast_realloc, thus avoiding potential memleaks and pointless memcpys.
author reimar
date Sun, 12 Apr 2009 13:17:37 +0000
parents 54bc8a2727b0
children bd3e11b60ccd
comparison
equal deleted inserted replaced
9414:5a738e8f9524 9415:141badec76fc
685 startcode_found=1; 685 startcode_found=1;
686 current_pos=0; 686 current_pos=0;
687 } 687 }
688 688
689 if(startcode_found){ 689 if(startcode_found){
690 s->bitstream_buffer= av_fast_realloc( 690 av_fast_malloc(
691 s->bitstream_buffer, 691 &s->bitstream_buffer,
692 &s->allocated_bitstream_buffer_size, 692 &s->allocated_bitstream_buffer_size,
693 buf_size - current_pos + FF_INPUT_BUFFER_PADDING_SIZE); 693 buf_size - current_pos + FF_INPUT_BUFFER_PADDING_SIZE);
694 if (!s->bitstream_buffer)
695 return AVERROR(ENOMEM);
694 memcpy(s->bitstream_buffer, buf + current_pos, buf_size - current_pos); 696 memcpy(s->bitstream_buffer, buf + current_pos, buf_size - current_pos);
695 s->bitstream_buffer_size= buf_size - current_pos; 697 s->bitstream_buffer_size= buf_size - current_pos;
696 } 698 }
697 } 699 }
698 700