mirror of
https://github.com/curl/curl.git
synced 2026-05-01 13:17:51 +03:00
urlapi: avoid mutating internals in getter routine
This was not intended. Closes #10708
This commit is contained in:
parent
0a0c9b6dfa
commit
95cb7d3166
1 changed files with 3 additions and 7 deletions
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…
Add table
Add a link
Reference in a new issue