replace unnecessary string malloc with strdup