Fix some potential memory leak.