fix a bug

There will be memory leak when process exit.