mirror of
https://github.com/curl/curl.git
synced 2026-08-25 15:13:41 +03:00
tool_operate: fix a case of ignoring return code in operate()
If get_args() returns error, do not overwrite the variable in the next call. Also, avoid allocating memory for the default user-agent. Closes #19650
This commit is contained in:
parent
4ebef2f0d9
commit
36b9987acb
3 changed files with 14 additions and 27 deletions
|
|
@ -650,14 +650,6 @@ long delegation(const char *str)
|
|||
return CURLGSSAPI_DELEGATION_NONE;
|
||||
}
|
||||
|
||||
/*
|
||||
* my_useragent: returns allocated string with default user agent
|
||||
*/
|
||||
static char *my_useragent(void)
|
||||
{
|
||||
return strdup(CURL_NAME "/" CURL_VERSION);
|
||||
}
|
||||
|
||||
#define isheadersep(x) ((((x)==':') || ((x)==';')))
|
||||
|
||||
/*
|
||||
|
|
@ -705,15 +697,6 @@ CURLcode get_args(struct OperationConfig *config, const size_t i)
|
|||
if(!result && config->proxyuserpwd)
|
||||
result = checkpasswd("proxy", i, last, &config->proxyuserpwd);
|
||||
|
||||
/* Check if we have a user agent */
|
||||
if(!result && !config->useragent) {
|
||||
config->useragent = my_useragent();
|
||||
if(!config->useragent) {
|
||||
errorf("out of memory");
|
||||
result = CURLE_OUT_OF_MEMORY;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue