Revision d1be646e

View differences:

libavcodec/vorbisdec.c
247 247

  
248 248
    AV_DEBUG(" Codebooks: %d \n", vc->codebook_count);
249 249

  
250
    vc->codebooks = av_mallocz(vc->codebook_count * sizeof(vorbis_codebook));
251
    tmp_vlc_bits  = av_mallocz(V_MAX_VLCS * sizeof(uint8_t));
252
    tmp_vlc_codes = av_mallocz(V_MAX_VLCS * sizeof(uint32_t));
250
    vc->codebooks = av_mallocz(vc->codebook_count * sizeof(*vc->codebooks));
251
    tmp_vlc_bits  = av_mallocz(V_MAX_VLCS * sizeof(*tmp_vlc_bits));
252
    tmp_vlc_codes = av_mallocz(V_MAX_VLCS * sizeof(*tmp_vlc_codes));
253 253
    codebook_multiplicands = av_malloc(V_MAX_VLCS * sizeof(*codebook_multiplicands));
254 254

  
255 255
    for (cb = 0; cb < vc->codebook_count; ++cb) {
......
360 360
            }
361 361

  
362 362
// Weed out unused vlcs and build codevector vector
363
            codebook_setup->codevectors = used_entries ? av_mallocz(used_entries*codebook_setup->dimensions * sizeof(float)) : NULL;
363
            codebook_setup->codevectors = used_entries ? av_mallocz(used_entries *
364
                                                                    codebook_setup->dimensions *
365
                                                                    sizeof(*codebook_setup->codevectors))
366
                                                       : NULL;
364 367
            for (j = 0, i = 0; i < entries; ++i) {
365 368
                uint_fast8_t dim = codebook_setup->dimensions;
366 369

  
......
472 475

  
473 476
    vc->floor_count = get_bits(gb, 6) + 1;
474 477

  
475
    vc->floors = av_mallocz(vc->floor_count * sizeof(vorbis_floor));
478
    vc->floors = av_mallocz(vc->floor_count * sizeof(*vc->floors));
476 479

  
477 480
    for (i = 0; i < vc->floor_count; ++i) {
478 481
        vorbis_floor *floor_setup = &vc->floors[i];
......
532 535
            for (j = 0; j < floor_setup->data.t1.partitions; ++j)
533 536
                floor_setup->data.t1.x_list_dim+=floor_setup->data.t1.class_dimensions[floor_setup->data.t1.partition_class[j]];
534 537

  
535
            floor_setup->data.t1.list = av_mallocz(floor_setup->data.t1.x_list_dim * sizeof(vorbis_floor1_entry));
538
            floor_setup->data.t1.list = av_mallocz(floor_setup->data.t1.x_list_dim *
539
                                                   sizeof(*floor_setup->data.t1.list));
536 540

  
537 541

  
538 542
            rangebits = get_bits(gb, 4);
......
597 601
            /* codebook dim is for padding if codebook dim doesn't *
598 602
             * divide order+1 then we need to read more data       */
599 603
            floor_setup->data.t0.lsp =
600
                av_malloc((floor_setup->data.t0.order+1 + max_codebook_dim)
601
                          * sizeof(float));
604
                av_malloc((floor_setup->data.t0.order + 1 + max_codebook_dim)
605
                          * sizeof(*floor_setup->data.t0.lsp));
602 606
            if (!floor_setup->data.t0.lsp)
603 607
                return -1;
604 608

  
......
640 644
    uint_fast8_t i, j, k;
641 645

  
642 646
    vc->residue_count = get_bits(gb, 6)+1;
643
    vc->residues      = av_mallocz(vc->residue_count * sizeof(vorbis_residue));
647
    vc->residues      = av_mallocz(vc->residue_count * sizeof(*vc->residues));
644 648

  
645 649
    AV_DEBUG(" There are %d residues. \n", vc->residue_count);
646 650

  
......
716 720
    uint_fast8_t i, j;
717 721

  
718 722
    vc->mapping_count = get_bits(gb, 6)+1;
719
    vc->mappings      = av_mallocz(vc->mapping_count * sizeof(vorbis_mapping));
723
    vc->mappings      = av_mallocz(vc->mapping_count * sizeof(*vc->mappings));
720 724

  
721 725
    AV_DEBUG(" There are %d mappings. \n", vc->mapping_count);
722 726

  
......
735 739

  
736 740
        if (get_bits1(gb)) {
737 741
            mapping_setup->coupling_steps = get_bits(gb, 8) + 1;
738
            mapping_setup->magnitude      = av_mallocz(mapping_setup->coupling_steps * sizeof(uint_fast8_t));
739
            mapping_setup->angle          = av_mallocz(mapping_setup->coupling_steps * sizeof(uint_fast8_t));
742
            mapping_setup->magnitude      = av_mallocz(mapping_setup->coupling_steps *
743
                                                       sizeof(*mapping_setup->magnitude));
744
            mapping_setup->angle          = av_mallocz(mapping_setup->coupling_steps *
745
                                                       sizeof(*mapping_setup->angle));
740 746
            for (j = 0; j < mapping_setup->coupling_steps; ++j) {
741 747
                GET_VALIDATED_INDEX(mapping_setup->magnitude[j], ilog(vc->audio_channels - 1), vc->audio_channels)
742 748
                GET_VALIDATED_INDEX(mapping_setup->angle[j],     ilog(vc->audio_channels - 1), vc->audio_channels)
......
753 759
        }
754 760

  
755 761
        if (mapping_setup->submaps>1) {
756
            mapping_setup->mux = av_mallocz(vc->audio_channels * sizeof(uint_fast8_t));
762
            mapping_setup->mux = av_mallocz(vc->audio_channels *
763
                                            sizeof(*mapping_setup->mux));
757 764
            for (j = 0; j < vc->audio_channels; ++j)
758 765
                mapping_setup->mux[j] = get_bits(gb, 4);
759 766
        }
......
813 820
    uint_fast8_t i;
814 821

  
815 822
    vc->mode_count = get_bits(gb, 6) + 1;
816
    vc->modes      = av_mallocz(vc->mode_count * sizeof(vorbis_mode));
823
    vc->modes      = av_mallocz(vc->mode_count * sizeof(*vc->modes));
817 824

  
818 825
    AV_DEBUG(" There are %d modes.\n", vc->mode_count);
819 826

  
......
925 932
        return -2;
926 933
    }
927 934

  
928
    vc->channel_residues =  av_malloc((vc->blocksize[1]  / 2) * vc->audio_channels * sizeof(float));
929
    vc->channel_floors   =  av_malloc((vc->blocksize[1]  / 2) * vc->audio_channels * sizeof(float));
930
    vc->saved            =  av_mallocz((vc->blocksize[1] / 4) * vc->audio_channels * sizeof(float));
935
    vc->channel_residues =  av_malloc((vc->blocksize[1]  / 2) * vc->audio_channels * sizeof(*vc->channel_residues));
936
    vc->channel_floors   =  av_malloc((vc->blocksize[1]  / 2) * vc->audio_channels * sizeof(*vc->channel_floors));
937
    vc->saved            =  av_mallocz((vc->blocksize[1] / 4) * vc->audio_channels * sizeof(*vc->saved));
931 938
    vc->previous_window  = 0;
932 939

  
933 940
    ff_mdct_init(&vc->mdct[0], bl0, 1, -vc->scale_bias);

Also available in: Unified diff