fix use-after-realloc issue with the request url