change malloc+strcpy to strdup