fix memory leak

use enca,cp_tmp should free.