fix free function problem in linux