Fix possible memory leak