Fixed some memory leaks in the engine.

We went through the trouble of creating it but never called it. Nice.