fixed memory leak in exit process.