Use a malloc(3) and a strcpy(3) instead of a strdup(3).