Tweaks to uses of 'mymalloc'

This small pull request does the following:

1. Don't cast the return value of `mymalloc()`; the `void *` is always promoted to the target pointer type (this is a C language feature).
2. Since `mymalloc()` is actually implemented with a call to `calloc()`, it returns zero'ed memory. Remove all zeroing calls to `memset` after `mymalloc()`; they were doing unnecessary work.
3. The `tfile_context()` function is simplified a great deal.
4. Remove some redundant `NULL` checks before calling `free()`: passing a `NULL` to `free()` is completely harmless.