fixed memory leak on error path in copy_in_string