Deleting pointer that caused some leaks