Problem: string buffers aren't NULL checked

Have found some places where memory is allocated and not NULL checked.
I have not touched the auto generated engine for zgossip which is also not checking for NULL pointers from strdup.

Tests pass locally.
This is wrong, hostname will rarely be empty in this case (needs an interrupt exactly during the configure option), however it will return an empty string, so testing for *hostname is essential.