[RFC] coverity/13765,13766,13767,13768: Fix memory leaks in hardcopy.c

coverity/13765,13766,13767,13768: Fix memory leaks in hardcopy.c

The function mch_print_begin() returns early in case of an
error, but without freeing allocated memory.
To fix this, use stack allocation instead of heap allocation
for the variables res_prolog, res_encoding, res_cidfont and
res_cmap.