Remove use of strndup.

At this point, I'm not checking all return values from library
calls. Soon it would be useful to add an assertion and logging
library to standardize this.