Fix some potential memory leak.

Fix some potential memory leak.