Fixed a memory leak for real multi-dimensional transforms.