urlapi: avoid mutating internals in getter routine
This was not intended. Closes #10708
This commit is contained in:
parent
0a0c9b6dfa
commit
95cb7d3166
10
lib/urlapi.c
10
lib/urlapi.c
@ -1441,11 +1441,8 @@ CURLUcode curl_url_get(CURLU *u, CURLUPart what,
|
||||
break;
|
||||
case CURLUPART_PATH:
|
||||
ptr = u->path;
|
||||
if(!ptr) {
|
||||
ptr = u->path = strdup("/");
|
||||
if(!u->path)
|
||||
return CURLUE_OUT_OF_MEMORY;
|
||||
}
|
||||
if(!ptr)
|
||||
ptr = "/";
|
||||
break;
|
||||
case CURLUPART_QUERY:
|
||||
ptr = u->query;
|
||||
@ -1555,8 +1552,7 @@ CURLUcode curl_url_get(CURLU *u, CURLUPart what,
|
||||
return CURLUE_OUT_OF_MEMORY;
|
||||
host++;
|
||||
}
|
||||
free(u->host);
|
||||
u->host = Curl_dyn_ptr(&enc);
|
||||
allochost = Curl_dyn_ptr(&enc);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user