Fix memory leak in emit_assembly / emit_object