On Thu, 28 Apr 2011, 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..4bd842e 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->magnitude));
> +            mapping_setup->angle          = 
> av_mallocz(mapping_setup->coupling_steps * sizeof(mapping_setup->angle));
>              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(mapping_setup->mux));
>              for (j = 0; j < vc->audio_channels; ++j)
>                  mapping_setup->mux[j] = get_bits(gb, 4);
>          }

This isn't right - as Måns pointed out in reply to the earlier mail, you 
should do

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

Now you do sizeof(ptr), which isn't what you want (usually it might be as 
big or bigger than what you want, in some cases it might be smaller).

// Martin
_______________________________________________
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to