fixed up memory leak in depth error