Fix possibly memory leak