Fix resource leak when using strdup(3).
Reported by: Coverity CID: 1357337 Sponsored by: iXsystems Inc.