Revision 1f96bafb libavcodec/parser.c

View differences:

libavcodec/parser.c
224 224

  
225 225
/**
226 226
 * combines the (truncated) bitstream to a complete frame
227
 * @returns -1 if no complete frame could be created
227
 * @returns -1 if no complete frame could be created, AVERROR(ENOMEM) if there was a memory allocation error
228 228
 */
229 229
int ff_combine_frame(ParseContext *pc, int next, const uint8_t **buf, int *buf_size)
230 230
{
......
249 249

  
250 250
    /* copy into buffer end return */
251 251
    if(next == END_NOT_FOUND){
252
        pc->buffer= av_fast_realloc(pc->buffer, &pc->buffer_size, (*buf_size) + pc->index + FF_INPUT_BUFFER_PADDING_SIZE);
252
        void* new_buffer = av_fast_realloc(pc->buffer, &pc->buffer_size, (*buf_size) + pc->index + FF_INPUT_BUFFER_PADDING_SIZE);
253 253

  
254
        if(!new_buffer)
255
            return AVERROR(ENOMEM);
256
        pc->buffer = new_buffer;
254 257
        memcpy(&pc->buffer[pc->index], *buf, *buf_size);
255 258
        pc->index += *buf_size;
256 259
        return -1;
......
261 264

  
262 265
    /* append to buffer */
263 266
    if(pc->index){
264
        pc->buffer= av_fast_realloc(pc->buffer, &pc->buffer_size, next + pc->index + FF_INPUT_BUFFER_PADDING_SIZE);
267
        void* new_buffer = av_fast_realloc(pc->buffer, &pc->buffer_size, next + pc->index + FF_INPUT_BUFFER_PADDING_SIZE);
265 268

  
269
        if(!new_buffer)
270
            return AVERROR(ENOMEM);
271
        pc->buffer = new_buffer;
266 272
        memcpy(&pc->buffer[pc->index], *buf, next + FF_INPUT_BUFFER_PADDING_SIZE );
267 273
        pc->index = 0;
268 274
        *buf= pc->buffer;

Also available in: Unified diff