Added a validation utility and fixed the uncovered bugs.

- hardened all mallocs and gzwrites against errors.
- fixed a double-free bug.
- fixed a binary dump bug where types would be output even when in a list.
- made nbt_dump_binary more resiliant against file errors.
3 files changed