From: Monty Date: Sat, 18 Dec 1999 18:58:20 +0000 (+0000) Subject: alloca() 'frees' memory when the function returns, not when we exit X-Git-Tag: v1.3.3~1313 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4ca7b121716646ce6597216b630a5eb5c8671488;p=platform%2Fupstream%2Flibvorbis.git alloca() 'frees' memory when the function returns, not when we exit local scope. Monty svn path=/trunk/vorbis/; revision=205 --- diff --git a/vq/train.c b/vq/train.c index 29e27ae..7d34b46 100644 --- a/vq/train.c +++ b/vq/train.c @@ -282,7 +282,7 @@ int main(int argc,char *argv[]){ } { int i; - double *b=alloca(cols*sizeof(double)); + double *b=malloc(cols*sizeof(double)); if(start*num+dim>cols){ fprintf(stderr,"ran out of columns reading %s\n",file); exit(1); @@ -308,6 +308,7 @@ int main(int argc,char *argv[]){ vqext_adjdata(b,start+i*dim,dim); vqgen_addpoint(&v,b+start+i*dim); } + free(b); } } fclose(in);