apigenerator: fix even more potential leaks