aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorandroid-build-team Robot <android-build-team-robot@google.com>2017-08-08 22:27:34 +0000
committerandroid-build-team Robot <android-build-team-robot@google.com>2017-08-08 22:27:34 +0000
commitc8cd9d7c01c3e56f567b18ba025071daef8f3453 (patch)
treebb3843032878746daf3ef6f89a06bf2aea05cf6c
parent5f7c1fedfbebd8c127a2e9f5afce5b97a8ba088d (diff)
parent398bad28aa24e6a639c78854dac8eb5b96354fed (diff)
downloadtremolo-c8cd9d7c01c3e56f567b18ba025071daef8f3453.tar.gz
Merge cherrypicks of [2688425, 2689040, 2689041, 2689042, 2688662, 2688663, 2688664, 2688426, 2688427, 2688428, 2688665, 2688666, 2688667, 2688668, 2688669, 2688670, 2688671, 2688429, 2688672, 2689043, 2688673, 2688674, 2688675, 2688676, 2688677, 2688678, 2688679, 2688430, 2688431] into oc-releaseandroid-8.0.0_r7
Change-Id: Ie805d24a40c7295487c71f49966717b4ee9b3dd4
-rw-r--r--Tremolo/res012.c36
1 files changed, 24 insertions, 12 deletions
diff --git a/Tremolo/res012.c b/Tremolo/res012.c
index 513d9ad..d6495fb 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;
}