Added a linear depth example and fixed a memory leak