Fix for memory leak.

This fixes the memory leak found in issue #7.  See that issue for sample code which will cause the leak.