Justin Ruggles <[email protected]> writes:

> On 04/27/2011 01:46 PM, Diego Biurrun wrote:
>
>> ---
>>  libavcodec/vorbisdec.c |    6 +++---
>>  1 files changed, 3 insertions(+), 3 deletions(-)
>> 
>> diff --git a/libavcodec/vorbisdec.c b/libavcodec/vorbisdec.c
>> index a9ddc7d..c698220 100644
>> --- a/libavcodec/vorbisdec.c
>> +++ b/libavcodec/vorbisdec.c
>> @@ -735,8 +735,8 @@ static int 
>> vorbis_parse_setup_hdr_mappings(vorbis_context *vc)
>>  
>>          if (get_bits1(gb)) {
>>              mapping_setup->coupling_steps = get_bits(gb, 8) + 1;
>> -            mapping_setup->magnitude      = 
>> av_mallocz(mapping_setup->coupling_steps * sizeof(uint_fast8_t));
>> -            mapping_setup->angle          = 
>> av_mallocz(mapping_setup->coupling_steps * sizeof(uint_fast8_t));
>> +            mapping_setup->magnitude      = 
>> av_mallocz(mapping_setup->coupling_steps * 
>> sizeof(mapping_setup->coupling_steps));
>> +            mapping_setup->angle          = 
>> av_mallocz(mapping_setup->coupling_steps * 
>> sizeof(mapping_setup->coupling_steps));
>>              for (j = 0; j < mapping_setup->coupling_steps; ++j) {
>>                  GET_VALIDATED_INDEX(mapping_setup->magnitude[j], 
>> ilog(vc->audio_channels - 1), vc->audio_channels)
>>                  GET_VALIDATED_INDEX(mapping_setup->angle[j],     
>> ilog(vc->audio_channels - 1), vc->audio_channels)
>> @@ -753,7 +753,7 @@ static int 
>> vorbis_parse_setup_hdr_mappings(vorbis_context *vc)
>>          }
>>  
>>          if (mapping_setup->submaps>1) {
>> -            mapping_setup->mux = av_mallocz(vc->audio_channels * 
>> sizeof(uint_fast8_t));
>> +            mapping_setup->mux = av_mallocz(vc->audio_channels * 
>> sizeof(vc->audio_channels));
>>              for (j = 0; j < vc->audio_channels; ++j)
>>                  mapping_setup->mux[j] = get_bits(gb, 4);
>>          }
>
> these changes don't make sense to me.  shouldn't the sizeof param be the
> size of one element in the destination array?

Yes, the patch makes no sense at all.  It should be like this:

  ptr = malloc(count * sizeof(*ptr))

-- 
Måns Rullgård
[email protected]
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to