Revert "Revert "Fixed some memory leaks""

This reverts commit 9a15afdcc0988d1676d59bc7d3bcd72bb3a03505.

Double negatives are confusing, but so is this BS.