Fixing leaks (#92); thanks to ksshelt and eltjpm.