Correctly cleanup class and string object when using valgrind
Fix memory leak in %putc/str/v opcode.