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