[ODE] bug in dxHeightfieldData dtor

David Walters hidden.asbestos at googlemail.com
Tue Aug 8 06:10:50 MST 2006

> There's a small bug in the dxHeightfieldData() destructor. It attempts to free the sample
> data by deleting a void pointer. AFAIK it needs to be typecast to the correct type,
> otherwise the behavior is undefined (although it compiles/runs fine on VC++2005),
> correct?
> Thanks Bram for this one.

I've checked in a fix for heightfield.cpp which should call array
delete _only_ on a variable cast to the type that was used in the
corresponding new call. I hope this fixes your warning, I've not
actually been able to test it, but it compiles okay in VS2003!

I've also fixed a rather glaringly obvious bug in the double precision
data path, the function dGeomHeightfieldDataBuildDouble was actually
allocating an array of *floats* and memcpy'ing the data using sizeof(
float ) to scale it - which clearly isn't going to give good results
for double precision data. Whoops!


More information about the ODE mailing list