fix memory leak handling hints
use nullptr over NULL everywhere