Problem: string buffers aren't NULL checked
check more allocations against NULL
alloc fixups
style and code fixups
zmq_msg_data casting fixup
revert unneeded changes
fix typo
fix leaking file handle

Also updated zdir and zfile to check for truthness first
@xaqq according to the comment at the top of the function the filename
shall be stored even when a error occurs?
Wouldn’t a free(filename_copy) also nullify self->filename?
Merge branch 'master' into strndup
Merge pull request #824 from Asmod4n/strndup

Problem: string buffers aren't NULL checked