search: handle str_copy failure