Adding memory leak checks to functional tests