small adjustment to remove unnecessary code and a memory leak

remove strdup as it will leak memory without free.