fix build on linux
use strdup
fixed memory leaks