quick fix memory leak + set ptrs. to 0 after free