Fix leak in assign_ref with function As far as I can see, the retval copying is already done in all callers of this function, so it should not be duplicated here.