mirror of
https://github.com/curl/curl.git
synced 2026-08-26 23:04:24 +03:00
parent
d3b04e5600
commit
bcd0497c81
19 changed files with 41 additions and 80 deletions
|
|
@ -507,8 +507,7 @@ CURLcode Curl_parse_interface(const char *input,
|
||||||
++host_part;
|
++host_part;
|
||||||
*host = curlx_memdup0(host_part, len - (host_part - input));
|
*host = curlx_memdup0(host_part, len - (host_part - input));
|
||||||
if(!*host) {
|
if(!*host) {
|
||||||
curlx_free(*iface);
|
curlx_safefree(*iface);
|
||||||
*iface = NULL;
|
|
||||||
return CURLE_OUT_OF_MEMORY;
|
return CURLE_OUT_OF_MEMORY;
|
||||||
}
|
}
|
||||||
return CURLE_OK;
|
return CURLE_OK;
|
||||||
|
|
|
||||||
|
|
@ -302,8 +302,7 @@ static OM_uint32 stub_gss_delete_sec_context(
|
||||||
return GSS_S_FAILURE;
|
return GSS_S_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
curlx_free(*context);
|
curlx_safefree(*context);
|
||||||
*context = NULL;
|
|
||||||
*min = 0;
|
*min = 0;
|
||||||
|
|
||||||
return GSS_S_COMPLETE;
|
return GSS_S_COMPLETE;
|
||||||
|
|
|
||||||
|
|
@ -3655,8 +3655,7 @@ static void ftp_done_path(struct Curl_easy *data, struct ftp_conn *ftpc,
|
||||||
* the error path) */
|
* the error path) */
|
||||||
ftpc->ctl_valid = FALSE; /* mark control connection as bad */
|
ftpc->ctl_valid = FALSE; /* mark control connection as bad */
|
||||||
connclose(conn, "FTP: out of memory!"); /* mark for connection closure */
|
connclose(conn, "FTP: out of memory!"); /* mark for connection closure */
|
||||||
curlx_free(ftpc->prevpath);
|
curlx_safefree(ftpc->prevpath); /* no path remembering */
|
||||||
ftpc->prevpath = NULL; /* no path remembering */
|
|
||||||
}
|
}
|
||||||
else { /* remember working directory for connection reuse */
|
else { /* remember working directory for connection reuse */
|
||||||
const char *rawPath = ftpc->rawpath;
|
const char *rawPath = ftpc->rawpath;
|
||||||
|
|
|
||||||
|
|
@ -199,10 +199,8 @@ void Curl_wildcard_dtor(struct WildcardData **wcp)
|
||||||
DEBUGASSERT(wc->ftpwc == NULL);
|
DEBUGASSERT(wc->ftpwc == NULL);
|
||||||
|
|
||||||
Curl_llist_destroy(&wc->filelist, NULL);
|
Curl_llist_destroy(&wc->filelist, NULL);
|
||||||
curlx_free(wc->path);
|
curlx_safefree(wc->path);
|
||||||
wc->path = NULL;
|
curlx_safefree(wc->pattern);
|
||||||
curlx_free(wc->pattern);
|
|
||||||
wc->pattern = NULL;
|
|
||||||
wc->state = CURLWC_INIT;
|
wc->state = CURLWC_INIT;
|
||||||
curlx_free(wc);
|
curlx_free(wc);
|
||||||
*wcp = NULL;
|
*wcp = NULL;
|
||||||
|
|
|
||||||
|
|
@ -67,11 +67,8 @@ void Curl_initinfo(struct Curl_easy *data)
|
||||||
info->httpauthpicked = 0;
|
info->httpauthpicked = 0;
|
||||||
info->numconnects = 0;
|
info->numconnects = 0;
|
||||||
|
|
||||||
curlx_free(info->contenttype);
|
curlx_safefree(info->contenttype);
|
||||||
info->contenttype = NULL;
|
curlx_safefree(info->wouldredirect);
|
||||||
|
|
||||||
curlx_free(info->wouldredirect);
|
|
||||||
info->wouldredirect = NULL;
|
|
||||||
|
|
||||||
memset(&info->primary, 0, sizeof(info->primary));
|
memset(&info->primary, 0, sizeof(info->primary));
|
||||||
info->retry_after = 0;
|
info->retry_after = 0;
|
||||||
|
|
|
||||||
|
|
@ -1976,10 +1976,8 @@ static CURLcode http_useragent(struct Curl_easy *data)
|
||||||
it might have been used in the proxy connect, but if we have got a header
|
it might have been used in the proxy connect, but if we have got a header
|
||||||
with the user-agent string specified, we erase the previously made string
|
with the user-agent string specified, we erase the previously made string
|
||||||
here. */
|
here. */
|
||||||
if(Curl_checkheaders(data, STRCONST("User-Agent"))) {
|
if(Curl_checkheaders(data, STRCONST("User-Agent")))
|
||||||
curlx_free(data->state.aptr.uagent);
|
curlx_safefree(data->state.aptr.uagent);
|
||||||
data->state.aptr.uagent = NULL;
|
|
||||||
}
|
|
||||||
return CURLE_OK;
|
return CURLE_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3972,8 +3972,7 @@ CURLcode Curl_multi_xfer_buf_borrow(struct Curl_easy *data,
|
||||||
if(data->multi->xfer_buf &&
|
if(data->multi->xfer_buf &&
|
||||||
data->set.buffer_size > data->multi->xfer_buf_len) {
|
data->set.buffer_size > data->multi->xfer_buf_len) {
|
||||||
/* not large enough, get a new one */
|
/* not large enough, get a new one */
|
||||||
curlx_free(data->multi->xfer_buf);
|
curlx_safefree(data->multi->xfer_buf);
|
||||||
data->multi->xfer_buf = NULL;
|
|
||||||
data->multi->xfer_buf_len = 0;
|
data->multi->xfer_buf_len = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -4025,8 +4024,7 @@ CURLcode Curl_multi_xfer_ulbuf_borrow(struct Curl_easy *data,
|
||||||
if(data->multi->xfer_ulbuf &&
|
if(data->multi->xfer_ulbuf &&
|
||||||
data->set.upload_buffer_size > data->multi->xfer_ulbuf_len) {
|
data->set.upload_buffer_size > data->multi->xfer_ulbuf_len) {
|
||||||
/* not large enough, get a new one */
|
/* not large enough, get a new one */
|
||||||
curlx_free(data->multi->xfer_ulbuf);
|
curlx_safefree(data->multi->xfer_ulbuf);
|
||||||
data->multi->xfer_ulbuf = NULL;
|
|
||||||
data->multi->xfer_ulbuf_len = 0;
|
data->multi->xfer_ulbuf_len = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -4073,8 +4071,7 @@ CURLcode Curl_multi_xfer_sockbuf_borrow(struct Curl_easy *data,
|
||||||
|
|
||||||
if(data->multi->xfer_sockbuf && blen > data->multi->xfer_sockbuf_len) {
|
if(data->multi->xfer_sockbuf && blen > data->multi->xfer_sockbuf_len) {
|
||||||
/* not large enough, get a new one */
|
/* not large enough, get a new one */
|
||||||
curlx_free(data->multi->xfer_sockbuf);
|
curlx_safefree(data->multi->xfer_sockbuf);
|
||||||
data->multi->xfer_sockbuf = NULL;
|
|
||||||
data->multi->xfer_sockbuf_len = 0;
|
data->multi->xfer_sockbuf_len = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
12
lib/url.c
12
lib/url.c
|
|
@ -1954,16 +1954,14 @@ static CURLcode url_set_conn_proxies(struct Curl_easy *data,
|
||||||
curlx_safefree(no_proxy);
|
curlx_safefree(no_proxy);
|
||||||
|
|
||||||
if(proxy && (!*proxy || (conn->scheme->flags & PROTOPT_NONETWORK))) {
|
if(proxy && (!*proxy || (conn->scheme->flags & PROTOPT_NONETWORK))) {
|
||||||
curlx_free(proxy); /* Do not bother with an empty proxy string
|
curlx_safefree(proxy); /* Do not bother with an empty proxy string
|
||||||
or if the protocol does not work with network */
|
or if the protocol does not work with network */
|
||||||
proxy = NULL;
|
|
||||||
}
|
}
|
||||||
if(pre_proxy && (!*pre_proxy ||
|
if(pre_proxy && (!*pre_proxy ||
|
||||||
(conn->scheme->flags & PROTOPT_NONETWORK))) {
|
(conn->scheme->flags & PROTOPT_NONETWORK))) {
|
||||||
curlx_free(pre_proxy); /* Do not bother with an empty socks proxy string
|
curlx_safefree(pre_proxy); /* Do not bother with an empty socks proxy
|
||||||
or if the protocol does not work with
|
string or if the protocol does not work
|
||||||
network */
|
with network */
|
||||||
pre_proxy = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
|
|
|
||||||
|
|
@ -155,8 +155,7 @@ CURLcode Curl_auth_create_gssapi_user_message(struct Curl_easy *data,
|
||||||
krb5->p_identity, NULL, NULL,
|
krb5->p_identity, NULL, NULL,
|
||||||
krb5->credentials, NULL);
|
krb5->credentials, NULL);
|
||||||
if(status != SEC_E_OK) {
|
if(status != SEC_E_OK) {
|
||||||
curlx_free(krb5->credentials);
|
curlx_safefree(krb5->credentials);
|
||||||
krb5->credentials = NULL;
|
|
||||||
return CURLE_LOGIN_DENIED;
|
return CURLE_LOGIN_DENIED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -433,15 +432,13 @@ void Curl_auth_cleanup_gssapi(struct kerberos5data *krb5)
|
||||||
/* Free our security context */
|
/* Free our security context */
|
||||||
if(krb5->context) {
|
if(krb5->context) {
|
||||||
Curl_pSecFn->DeleteSecurityContext(krb5->context);
|
Curl_pSecFn->DeleteSecurityContext(krb5->context);
|
||||||
curlx_free(krb5->context);
|
curlx_safefree(krb5->context);
|
||||||
krb5->context = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Free our credentials handle */
|
/* Free our credentials handle */
|
||||||
if(krb5->credentials) {
|
if(krb5->credentials) {
|
||||||
Curl_pSecFn->FreeCredentialsHandle(krb5->credentials);
|
Curl_pSecFn->FreeCredentialsHandle(krb5->credentials);
|
||||||
curlx_free(krb5->credentials);
|
curlx_safefree(krb5->credentials);
|
||||||
krb5->credentials = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Free our identity */
|
/* Free our identity */
|
||||||
|
|
|
||||||
|
|
@ -140,8 +140,7 @@ CURLcode Curl_auth_create_ntlm_type1_message(struct Curl_easy *data,
|
||||||
ntlm->p_identity, NULL, NULL,
|
ntlm->p_identity, NULL, NULL,
|
||||||
ntlm->credentials, NULL);
|
ntlm->credentials, NULL);
|
||||||
if(status != SEC_E_OK) {
|
if(status != SEC_E_OK) {
|
||||||
curlx_free(ntlm->credentials);
|
curlx_safefree(ntlm->credentials);
|
||||||
ntlm->credentials = NULL;
|
|
||||||
return CURLE_LOGIN_DENIED;
|
return CURLE_LOGIN_DENIED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -328,15 +327,13 @@ void Curl_auth_cleanup_ntlm(struct ntlmdata *ntlm)
|
||||||
/* Free our security context */
|
/* Free our security context */
|
||||||
if(ntlm->context) {
|
if(ntlm->context) {
|
||||||
Curl_pSecFn->DeleteSecurityContext(ntlm->context);
|
Curl_pSecFn->DeleteSecurityContext(ntlm->context);
|
||||||
curlx_free(ntlm->context);
|
curlx_safefree(ntlm->context);
|
||||||
ntlm->context = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Free our credentials handle */
|
/* Free our credentials handle */
|
||||||
if(ntlm->credentials) {
|
if(ntlm->credentials) {
|
||||||
Curl_pSecFn->FreeCredentialsHandle(ntlm->credentials);
|
Curl_pSecFn->FreeCredentialsHandle(ntlm->credentials);
|
||||||
curlx_free(ntlm->credentials);
|
curlx_safefree(ntlm->credentials);
|
||||||
ntlm->credentials = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Free our identity */
|
/* Free our identity */
|
||||||
|
|
|
||||||
|
|
@ -160,8 +160,7 @@ CURLcode Curl_auth_decode_spnego_message(struct Curl_easy *data,
|
||||||
nego->p_identity, NULL, NULL,
|
nego->p_identity, NULL, NULL,
|
||||||
nego->credentials, NULL);
|
nego->credentials, NULL);
|
||||||
if(nego->status != SEC_E_OK) {
|
if(nego->status != SEC_E_OK) {
|
||||||
curlx_free(nego->credentials);
|
curlx_safefree(nego->credentials);
|
||||||
nego->credentials = NULL;
|
|
||||||
return CURLE_AUTH_ERROR;
|
return CURLE_AUTH_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -323,15 +322,13 @@ void Curl_auth_cleanup_spnego(struct negotiatedata *nego)
|
||||||
/* Free our security context */
|
/* Free our security context */
|
||||||
if(nego->context) {
|
if(nego->context) {
|
||||||
Curl_pSecFn->DeleteSecurityContext(nego->context);
|
Curl_pSecFn->DeleteSecurityContext(nego->context);
|
||||||
curlx_free(nego->context);
|
curlx_safefree(nego->context);
|
||||||
nego->context = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Free our credentials handle */
|
/* Free our credentials handle */
|
||||||
if(nego->credentials) {
|
if(nego->credentials) {
|
||||||
Curl_pSecFn->FreeCredentialsHandle(nego->credentials);
|
Curl_pSecFn->FreeCredentialsHandle(nego->credentials);
|
||||||
curlx_free(nego->credentials);
|
curlx_safefree(nego->credentials);
|
||||||
nego->credentials = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Free our identity */
|
/* Free our identity */
|
||||||
|
|
|
||||||
|
|
@ -238,10 +238,8 @@ CURLcode Curl_vtls_apple_verify(struct Curl_cfilter *cf,
|
||||||
err_desc = curlx_malloc(size + 1);
|
err_desc = curlx_malloc(size + 1);
|
||||||
if(err_desc) {
|
if(err_desc) {
|
||||||
if(!CFStringGetCString(error_ref, err_desc, size,
|
if(!CFStringGetCString(error_ref, err_desc, size,
|
||||||
kCFStringEncodingUTF8)) {
|
kCFStringEncodingUTF8))
|
||||||
curlx_free(err_desc);
|
curlx_safefree(err_desc);
|
||||||
err_desc = NULL;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
infof(data, "Apple SecTrust failure %ld%s%s", code,
|
infof(data, "Apple SecTrust failure %ld%s%s", code,
|
||||||
|
|
|
||||||
|
|
@ -632,8 +632,7 @@ void Curl_ssl_free_certinfo(struct Curl_easy *data)
|
||||||
ci->certinfo[i] = NULL;
|
ci->certinfo[i] = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
curlx_free(ci->certinfo); /* free the actual array too */
|
curlx_safefree(ci->certinfo); /* free the actual array too */
|
||||||
ci->certinfo = NULL;
|
|
||||||
ci->num_of_certs = 0;
|
ci->num_of_certs = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -43,10 +43,8 @@
|
||||||
|
|
||||||
static ParameterError getstr(char **str, const char *val, bool allowblank)
|
static ParameterError getstr(char **str, const char *val, bool allowblank)
|
||||||
{
|
{
|
||||||
if(*str) {
|
if(*str)
|
||||||
curlx_free(*str);
|
curlx_safefree(*str);
|
||||||
*str = NULL;
|
|
||||||
}
|
|
||||||
DEBUGASSERT(val);
|
DEBUGASSERT(val);
|
||||||
if(!allowblank && !val[0])
|
if(!allowblank && !val[0])
|
||||||
return PARAM_BLANK_STRING;
|
return PARAM_BLANK_STRING;
|
||||||
|
|
@ -61,10 +59,8 @@ static ParameterError getstr(char **str, const char *val, bool allowblank)
|
||||||
static ParameterError getstrn(char **str, const char *val,
|
static ParameterError getstrn(char **str, const char *val,
|
||||||
size_t len, bool allowblank)
|
size_t len, bool allowblank)
|
||||||
{
|
{
|
||||||
if(*str) {
|
if(*str)
|
||||||
curlx_free(*str);
|
curlx_safefree(*str);
|
||||||
*str = NULL;
|
|
||||||
}
|
|
||||||
DEBUGASSERT(val);
|
DEBUGASSERT(val);
|
||||||
if(!allowblank && !val[0])
|
if(!allowblank && !val[0])
|
||||||
return PARAM_BLANK_STRING;
|
return PARAM_BLANK_STRING;
|
||||||
|
|
|
||||||
|
|
@ -60,8 +60,7 @@ static void t518_close_file_descriptors(void)
|
||||||
t518_num_open.rlim_cur++)
|
t518_num_open.rlim_cur++)
|
||||||
if(t518_testfd[t518_num_open.rlim_cur] > 0)
|
if(t518_testfd[t518_num_open.rlim_cur] > 0)
|
||||||
curlx_close(t518_testfd[t518_num_open.rlim_cur]);
|
curlx_close(t518_testfd[t518_num_open.rlim_cur]);
|
||||||
curlx_free(t518_testfd);
|
curlx_safefree(t518_testfd);
|
||||||
t518_testfd = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int t518_fopen_works(void)
|
static int t518_fopen_works(void)
|
||||||
|
|
@ -289,8 +288,7 @@ static int t518_test_rlimit(int keep_open)
|
||||||
curl_msnprintf(strbuff, sizeof(strbuff), "opening of %s failed", DEV_NULL);
|
curl_msnprintf(strbuff, sizeof(strbuff), "opening of %s failed", DEV_NULL);
|
||||||
t518_store_errmsg(strbuff, errno);
|
t518_store_errmsg(strbuff, errno);
|
||||||
curl_mfprintf(stderr, "%s\n", t518_msgbuff);
|
curl_mfprintf(stderr, "%s\n", t518_msgbuff);
|
||||||
curlx_free(t518_testfd);
|
curlx_safefree(t518_testfd);
|
||||||
t518_testfd = NULL;
|
|
||||||
curlx_free(memchunk);
|
curlx_free(memchunk);
|
||||||
return -8;
|
return -8;
|
||||||
}
|
}
|
||||||
|
|
@ -330,8 +328,7 @@ static int t518_test_rlimit(int keep_open)
|
||||||
t518_testfd[t518_num_open.rlim_cur] >= 0;
|
t518_testfd[t518_num_open.rlim_cur] >= 0;
|
||||||
t518_num_open.rlim_cur++)
|
t518_num_open.rlim_cur++)
|
||||||
curlx_close(t518_testfd[t518_num_open.rlim_cur]);
|
curlx_close(t518_testfd[t518_num_open.rlim_cur]);
|
||||||
curlx_free(t518_testfd);
|
curlx_safefree(t518_testfd);
|
||||||
t518_testfd = NULL;
|
|
||||||
curlx_free(memchunk);
|
curlx_free(memchunk);
|
||||||
return -9;
|
return -9;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -57,8 +57,7 @@ static void t537_close_file_descriptors(void)
|
||||||
t537_num_open.rlim_cur++)
|
t537_num_open.rlim_cur++)
|
||||||
if(t537_testfd[t537_num_open.rlim_cur] > 0)
|
if(t537_testfd[t537_num_open.rlim_cur] > 0)
|
||||||
curlx_close(t537_testfd[t537_num_open.rlim_cur]);
|
curlx_close(t537_testfd[t537_num_open.rlim_cur]);
|
||||||
curlx_free(t537_testfd);
|
curlx_safefree(t537_testfd);
|
||||||
t537_testfd = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int t537_fopen_works(void)
|
static int t537_fopen_works(void)
|
||||||
|
|
@ -291,8 +290,7 @@ static int t537_test_rlimit(int keep_open)
|
||||||
curl_msnprintf(strbuff, sizeof(strbuff), "opening of %s failed", DEV_NULL);
|
curl_msnprintf(strbuff, sizeof(strbuff), "opening of %s failed", DEV_NULL);
|
||||||
t537_store_errmsg(strbuff, errno);
|
t537_store_errmsg(strbuff, errno);
|
||||||
curl_mfprintf(stderr, "%s\n", t537_msgbuff);
|
curl_mfprintf(stderr, "%s\n", t537_msgbuff);
|
||||||
curlx_free(t537_testfd);
|
curlx_safefree(t537_testfd);
|
||||||
t537_testfd = NULL;
|
|
||||||
curlx_free(memchunk);
|
curlx_free(memchunk);
|
||||||
return -7;
|
return -7;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -47,9 +47,8 @@ static int loadfile(const char *filename, void **filedata, size_t *filesize)
|
||||||
continue_reading = FALSE;
|
continue_reading = FALSE;
|
||||||
curlx_fclose(fInCert);
|
curlx_fclose(fInCert);
|
||||||
if(!continue_reading) {
|
if(!continue_reading) {
|
||||||
curlx_free(data);
|
curlx_safefree(data);
|
||||||
datasize = 0;
|
datasize = 0;
|
||||||
data = NULL;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -132,8 +132,7 @@ static CURLcode test_unit1607(const char *arg)
|
||||||
goto error;
|
goto error;
|
||||||
dns = Curl_hash_pick(&multi->dnscache.entries,
|
dns = Curl_hash_pick(&multi->dnscache.entries,
|
||||||
entry_id, strlen(entry_id) + 1);
|
entry_id, strlen(entry_id) + 1);
|
||||||
curlx_free(entry_id);
|
curlx_safefree(entry_id);
|
||||||
entry_id = NULL;
|
|
||||||
|
|
||||||
addr = dns ? dns->addr : NULL;
|
addr = dns ? dns->addr : NULL;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -134,8 +134,7 @@ static CURLcode test_unit1609(const char *arg)
|
||||||
|
|
||||||
dns = Curl_hash_pick(&multi->dnscache.entries,
|
dns = Curl_hash_pick(&multi->dnscache.entries,
|
||||||
entry_id, strlen(entry_id) + 1);
|
entry_id, strlen(entry_id) + 1);
|
||||||
curlx_free(entry_id);
|
curlx_safefree(entry_id);
|
||||||
entry_id = NULL;
|
|
||||||
|
|
||||||
addr = dns ? dns->addr : NULL;
|
addr = dns ? dns->addr : NULL;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue