diff options
author | android-build-team Robot <android-build-team-robot@google.com> | 2017-07-26 23:18:15 +0000 |
---|---|---|
committer | android-build-team Robot <android-build-team-robot@google.com> | 2017-07-26 23:18:15 +0000 |
commit | e85d672396f84a24171da6546f440620bef81bef (patch) | |
tree | 59ce08a0f3b6cdb2518126ad99a114d9abe4f48f | |
parent | b92488271664963fc760e1d5e50d3c0b437f900f (diff) | |
parent | f6d95278b68a0631340c3176f1fb176e363d1d80 (diff) | |
download | tremolo-nougat-mr1-flounder-release.tar.gz |
Merge cherrypicks of [2604297, 2604299, 2604519, 2606195, 2605695, 2604520, 2606196, 2604521, 2604522, 2606197, 2604523, 2605696, 2605697, 2605698, 2606198, 2604524, 2604525, 2604526, 2604300, 2604527, 2606199, 2604528, 2604529, 2604301, 2606200, 2604302, 2606410, 2606201, 2606411, 2606202, 2606413, 2606203, 2606414, 2604303, 2604304, 2606204, 2604305, 2606206, 2606207, 2604306, 2606415, 2606208, 2606209, 2606416] into nyc-mr1-volantis-releaseandroid-7.1.1_r53nougat-mr1-flounder-release
Change-Id: I5a3b8db8c48b5850ac88d17a83d581246a0d7591
-rw-r--r-- | Tremolo/res012.c | 36 |
1 files changed, 24 insertions, 12 deletions
diff --git a/Tremolo/res012.c b/Tremolo/res012.c index be279d0..b26c8a6 100644 --- a/Tremolo/res012.c +++ b/Tremolo/res012.c @@ -126,10 +126,13 @@ int res_inverse(vorbis_dsp_state *vd,vorbis_info_residue *info, if(used){ - char **partword=(char **)alloca(ch*sizeof(*partword)); - for(j=0;j<ch;j++) - partword[j]=(char *)alloca(partwords*partitions_per_word* - sizeof(*partword[j])); + char **partword=(char **)_ogg_calloc(ch,sizeof(*partword)); + if(partword==NULL)goto cleanup1; + for(j=0;j<ch;j++){ + partword[j]=(char *)_ogg_malloc(partwords*partitions_per_word* + sizeof(*partword[j])); + if(partword[j]==NULL)goto cleanup1; + } for(s=0;s<info->stages;s++){ @@ -147,7 +150,7 @@ int res_inverse(vorbis_dsp_state *vd,vorbis_info_residue *info, for(j=0;j<ch;j++){ int temp=vorbis_book_decode(phrasebook,&vd->opb); - if(temp==-1)goto eopbreak; + if(temp==-1)goto cleanup1; /* this can be done quickly in assembly due to the quotient always being at most six bits */ @@ -171,16 +174,23 @@ int res_inverse(vorbis_dsp_state *vd,vorbis_info_residue *info, if(info->type){ if(vorbis_book_decodev_add(stagebook,in[j]+offset,&vd->opb, samples_per_partition,-8)==-1) - goto eopbreak; + goto cleanup1; }else{ if(vorbis_book_decodevs_add(stagebook,in[j]+offset,&vd->opb, samples_per_partition,-8)==-1) - goto eopbreak; + goto cleanup1; } } } } } + cleanup1: + if(partword){ + for(j=0;j<ch;j++){ + if(partword[j])_ogg_free(partword[j]); + } + _ogg_free(partword); + } } } }else{ @@ -193,11 +203,12 @@ int res_inverse(vorbis_dsp_state *vd,vorbis_info_residue *info, int partwords=(partvals+partitions_per_word-1)/partitions_per_word; char *partword= - (char *)alloca(partwords*partitions_per_word*sizeof(*partword)); + (char *)_ogg_malloc(partwords*partitions_per_word*sizeof(*partword)); + if(partword==NULL)goto cleanup2; int beginoff=info->begin/ch; for(i=0;i<ch;i++)if(nonzero[i])break; - if(i==ch)return(0); /* no nonzero vectors */ + if(i==ch)goto cleanup2; /* no nonzero vectors */ samples_per_partition/=ch; @@ -212,7 +223,7 @@ int res_inverse(vorbis_dsp_state *vd,vorbis_info_residue *info, /* fetch the partition word */ temp=vorbis_book_decode(phrasebook,&vd->opb); - if(temp==-1)goto eopbreak; + if(temp==-1)goto cleanup2; /* this can be done quickly in assembly due to the quotient always being at most six bits */ @@ -233,14 +244,15 @@ int res_inverse(vorbis_dsp_state *vd,vorbis_info_residue *info, i*samples_per_partition+beginoff,ch, &vd->opb, samples_per_partition,-8)==-1) - goto eopbreak; + goto cleanup2; } } } } + cleanup2: + if(partword)_ogg_free(partword); } } - eopbreak: return 0; } |