More and better leak fixes after commit 9729bf0e0.