Remove an unused variable and plug a theoretical memory leak