Fix leak. Fixes #1142.