fixed crash bug caused by freeing string buffer twice