Don't depend on 'Cardinal' being declared and fix a memory leak.

This should fix issue #93.