Fix memory leak and compiler warning

yea, it is not referenced anywhere.