Fix memory leak and compiler warning

So is this variable never referenced?