Add memory leak checking