Fix compilation warnings

Also, inadvertently, prevent memory issues by validating the return value of `vasprintf`.

Closes #5.