Revision c2a3dcaf

View differences:

libavformat/nutdec.c
500 500
    int64_t filesize= url_fsize(bc);
501 501
    int64_t *syncpoints;
502 502
    int8_t *has_keyframe;
503
    int ret= -1;
503 504

  
504 505
    url_fseek(bc, filesize-12, SEEK_SET);
505 506
    url_fseek(bc, filesize-get_be64(bc), SEEK_SET);
......
516 517
    syncpoints= av_malloc(sizeof(int64_t)*syncpoint_count);
517 518
    has_keyframe= av_malloc(sizeof(int8_t)*(syncpoint_count+1));
518 519
    for(i=0; i<syncpoint_count; i++){
519
        GET_V(syncpoints[i], tmp>0)
520
        syncpoints[i] = ff_get_v(bc);
521
        if(syncpoints[i] <= 0)
522
            goto fail;
520 523
        if(i)
521 524
            syncpoints[i] += syncpoints[i-1];
522 525
    }
......
533 536
                x>>=1;
534 537
                if(n+x >= syncpoint_count + 1){
535 538
                    av_log(s, AV_LOG_ERROR, "index overflow A\n");
536
                    return -1;
539
                    goto fail;
537 540
                }
538 541
                while(x--)
539 542
                    has_keyframe[n++]= flag;
......
542 545
                while(x != 1){
543 546
                    if(n>=syncpoint_count + 1){
544 547
                        av_log(s, AV_LOG_ERROR, "index overflow B\n");
545
                        return -1;
548
                        goto fail;
546 549
                    }
547 550
                    has_keyframe[n++]= x&1;
548 551
                    x>>=1;
......
550 553
            }
551 554
            if(has_keyframe[0]){
552 555
                av_log(s, AV_LOG_ERROR, "keyframe before first syncpoint in index\n");
553
                return -1;
556
                goto fail;
554 557
            }
555 558
            assert(n<=syncpoint_count+1);
556 559
            for(; j<n && j<syncpoint_count; j++){
......
577 580

  
578 581
    if(skip_reserved(bc, end) || get_checksum(bc)){
579 582
        av_log(s, AV_LOG_ERROR, "index checksum mismatch\n");
580
        return -1;
583
        goto fail;
581 584
    }
582
    return 0;
585
    ret= 0;
586
fail:
587
    av_free(syncpoints);
588
    av_free(has_keyframe);
589
    return ret;
583 590
}
584 591

  
585 592
static int nut_read_header(AVFormatContext *s, AVFormatParameters *ap)

Also available in: Unified diff