in reply to Attempt to copy freed scalar and return value semantics
Probably the context.
Maybe you could try:
and see you you still get the panic.