Mercurial > libavcodec.hg
comparison mdec.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 | 3a2f437d2fea |
comparison
equal
deleted
inserted
replaced
9414:5a738e8f9524 | 9415:141badec76fc |
---|---|
172 return -1; | 172 return -1; |
173 } | 173 } |
174 p->pict_type= FF_I_TYPE; | 174 p->pict_type= FF_I_TYPE; |
175 p->key_frame= 1; | 175 p->key_frame= 1; |
176 | 176 |
177 a->bitstream_buffer= av_fast_realloc(a->bitstream_buffer, &a->bitstream_buffer_size, buf_size + FF_INPUT_BUFFER_PADDING_SIZE); | 177 av_fast_malloc(&a->bitstream_buffer, &a->bitstream_buffer_size, buf_size + FF_INPUT_BUFFER_PADDING_SIZE); |
178 if (!a->bitstream_buffer) | |
179 return AVERROR(ENOMEM); | |
178 for(i=0; i<buf_size; i+=2){ | 180 for(i=0; i<buf_size; i+=2){ |
179 a->bitstream_buffer[i] = buf[i+1]; | 181 a->bitstream_buffer[i] = buf[i+1]; |
180 a->bitstream_buffer[i+1]= buf[i ]; | 182 a->bitstream_buffer[i+1]= buf[i ]; |
181 } | 183 } |
182 init_get_bits(&a->gb, a->bitstream_buffer, buf_size*8); | 184 init_get_bits(&a->gb, a->bitstream_buffer, buf_size*8); |