BUG: Fix memory leak in ndarray construction from strings (gh-2927)