mirror of
https://github.com/curl/curl.git
synced 2025-02-23 15:10:03 +08:00
tool_operate: fix potential memory-leak
A 'CURLU *' would leak if url_proto() is called with no URL.
Detected by Coverity. CID 1494643.
Follow-up to 18270893ab
Closes #8098
This commit is contained in:
parent
a40160aee8
commit
75b31ce626
@ -668,6 +668,7 @@ static long url_proto(char *url)
|
||||
{
|
||||
CURLU *uh = curl_url();
|
||||
long proto = 0;
|
||||
if(uh) {
|
||||
if(url) {
|
||||
if(!curl_url_set(uh, CURLUPART_URL, url,
|
||||
CURLU_GUESS_SCHEME | CURLU_NON_SUPPORT_SCHEME)) {
|
||||
@ -679,6 +680,7 @@ static long url_proto(char *url)
|
||||
curl_free(schemep);
|
||||
}
|
||||
}
|
||||
}
|
||||
curl_url_cleanup(uh);
|
||||
}
|
||||
return proto;
|
||||
|
Loading…
Reference in New Issue
Block a user