From: Andy R. <an...@pl...> - 2008-01-22 20:09:17
|
till busch wrote: > * f_interpolate in NasalSys was leaky (valgrind) This leak is real, but the patch isn't legal C++, at least as of the last time I read the standard. You can't initialize a stack array with a dynamic value, it has to be known at compile time. This is a gcc extension. Better just to delete the arrays. Fixed in CVS. > --- src/Scripting/NasalSys.cxx 5 Dec 2007 10:57:51 -0000 1.97 > +++ src/Scripting/NasalSys.cxx 21 Jan 2008 21:30:11 -0000 > @@ -317,8 +317,8 @@ static naRef f_interpolate(naContext c, > naRef curve = argc > 1 ? args[1] : naNil(); > if(!naIsVector(curve)) return naNil(); > int nPoints = naVec_size(curve) / 2; > - double* values = new double[nPoints]; > - double* deltas = new double[nPoints]; > + double values[nPoints]; > + double deltas[nPoints]; > for(int i=0; i<nPoints; i++) { > values[i] = naNumValue(naVec_get(curve, 2*i)).num; > deltas[i] = naNumValue(naVec_get(curve, 2*i+1)).num; |