From 4ca7b121716646ce6597216b630a5eb5c8671488 Mon Sep 17 00:00:00 2001 From: Monty Date: Sat, 18 Dec 1999 18:58:20 +0000 Subject: [PATCH] alloca() 'frees' memory when the function returns, not when we exit local scope. Monty svn path=/trunk/vorbis/; revision=205 --- vq/train.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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); -- 2.7.4