summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2015-03-16 15:01:15 +0100
committerDaniel Stenberg <daniel@haxx.se>2015-03-16 15:01:15 +0100
commit0f4a03cbb6fdb84d05cb6aafe50444edad4f4119 (patch)
tree89472eece4173a97ac3b80aba5e35ed70cdd7845
parent9e661601feba03d1158ac466a457d5a6ce7f3f11 (diff)
downloadcurl-0f4a03cbb6fdb84d05cb6aafe50444edad4f4119.tar.gz
free: instead of Curl_safefree()
Since we just started make use of free(NULL) in order to simplify code, this change takes it a step further and: - converts lots of Curl_safefree() calls to good old free() - makes Curl_safefree() not check the pointer before free() The (new) rule of thumb is: if you really want a function call that frees a pointer and then assigns it to NULL, then use Curl_safefree(). But we will prefer just using free() from now on.
-rw-r--r--lib/asyn-ares.c4
-rw-r--r--lib/asyn-thread.c2
-rw-r--r--lib/base64.c2
-rw-r--r--lib/bundles.c4
-rw-r--r--lib/cookie.c2
-rw-r--r--lib/curl_multibyte.c6
-rw-r--r--lib/curl_ntlm.c4
-rw-r--r--lib/curl_ntlm_core.c5
-rw-r--r--lib/curl_ntlm_msgs.c2
-rw-r--r--lib/curl_ntlm_wb.c18
-rw-r--r--lib/curl_sasl.c44
-rw-r--r--lib/curl_sasl_gssapi.c20
-rw-r--r--lib/curl_sasl_sspi.c84
-rw-r--r--lib/curl_threads.c4
-rw-r--r--lib/formdata.c24
-rw-r--r--lib/ftp.c10
-rw-r--r--lib/gopher.c6
-rw-r--r--lib/http.c6
-rw-r--r--lib/http2.c4
-rw-r--r--lib/http_negotiate.c6
-rw-r--r--lib/http_negotiate_sspi.c2
-rw-r--r--lib/http_proxy.c4
-rw-r--r--lib/imap.c22
-rw-r--r--lib/ldap.c10
-rw-r--r--lib/memdebug.h4
-rw-r--r--lib/multi.c2
-rw-r--r--lib/netrc.c4
-rw-r--r--lib/pipeline.c8
-rw-r--r--lib/smb.c6
-rw-r--r--lib/smtp.c16
-rw-r--r--lib/socks_sspi.c20
-rw-r--r--lib/ssh.c10
-rw-r--r--lib/tftp.c2
-rw-r--r--lib/url.c35
-rw-r--r--tests/data/test962
35 files changed, 202 insertions, 202 deletions
diff --git a/lib/asyn-ares.c b/lib/asyn-ares.c
index c5ec48dbb..724809d4e 100644
--- a/lib/asyn-ares.c
+++ b/lib/asyn-ares.c
@@ -533,7 +533,7 @@ Curl_addrinfo *Curl_resolver_getaddrinfo(struct connectdata *conn,
bufp = strdup(hostname);
if(bufp) {
struct ResolverResults *res = NULL;
- Curl_safefree(conn->async.hostname);
+ free(conn->async.hostname);
conn->async.hostname = bufp;
conn->async.port = port;
conn->async.done = FALSE; /* not done */
@@ -541,7 +541,7 @@ Curl_addrinfo *Curl_resolver_getaddrinfo(struct connectdata *conn,
conn->async.dns = NULL; /* clear */
res = calloc(sizeof(struct ResolverResults),1);
if(!res) {
- Curl_safefree(conn->async.hostname);
+ free(conn->async.hostname);
conn->async.hostname = NULL;
return NULL;
}
diff --git a/lib/asyn-thread.c b/lib/asyn-thread.c
index 1d782b8ca..7de5d9314 100644
--- a/lib/asyn-thread.c
+++ b/lib/asyn-thread.c
@@ -393,7 +393,7 @@ static bool init_resolve_thread (struct connectdata *conn,
if(!init_thread_sync_data(td, hostname, port, hints))
goto err_exit;
- Curl_safefree(conn->async.hostname);
+ free(conn->async.hostname);
conn->async.hostname = strdup(hostname);
if(!conn->async.hostname)
goto err_exit;
diff --git a/lib/base64.c b/lib/base64.c
index 648ee1e5d..1defca19e 100644
--- a/lib/base64.c
+++ b/lib/base64.c
@@ -149,7 +149,7 @@ CURLcode Curl_base64_decode(const char *src,
for(i = 0; i < numQuantums; i++) {
size_t result = decodeQuantum(pos, src);
if(!result) {
- Curl_safefree(newstr);
+ free(newstr);
return CURLE_BAD_CONTENT_ENCODING;
}
diff --git a/lib/bundles.c b/lib/bundles.c
index aadf02656..ff1648693 100644
--- a/lib/bundles.c
+++ b/lib/bundles.c
@@ -6,7 +6,7 @@
* \___|\___/|_| \_\_____|
*
* Copyright (C) 2012, Linus Nielsen Feltzing, <linus@haxx.se>
- * Copyright (C) 2012, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 2012-2015, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -74,7 +74,7 @@ void Curl_bundle_destroy(struct connectbundle *cb_ptr)
Curl_llist_destroy(cb_ptr->conn_list, NULL);
cb_ptr->conn_list = NULL;
}
- Curl_safefree(cb_ptr);
+ free(cb_ptr);
}
/* Add a connection to a bundle */
diff --git a/lib/cookie.c b/lib/cookie.c
index b71eab43f..ddf6f72b1 100644
--- a/lib/cookie.c
+++ b/lib/cookie.c
@@ -949,7 +949,7 @@ struct CookieInfo *Curl_cookie_init(struct SessionHandle *data,
return c;
fail:
- Curl_safefree(line);
+ free(line);
if(!inc)
/* Only clean up if we allocated it here, as the original could still be in
* use by a share handle */
diff --git a/lib/curl_multibyte.c b/lib/curl_multibyte.c
index 761cadda7..403d00537 100644
--- a/lib/curl_multibyte.c
+++ b/lib/curl_multibyte.c
@@ -47,7 +47,8 @@ wchar_t *Curl_convert_UTF8_to_wchar(const char *str_utf8)
if(str_w) {
if(MultiByteToWideChar(CP_UTF8, 0, str_utf8, -1, str_w,
str_w_len) == 0) {
- Curl_safefree(str_w);
+ free(str_w);
+ return NULL;
}
}
}
@@ -68,7 +69,8 @@ char *Curl_convert_wchar_to_UTF8(const wchar_t *str_w)
if(str_utf8) {
if(WideCharToMultiByte(CP_UTF8, 0, str_w, -1, str_utf8, str_utf8_len,
NULL, FALSE) == 0) {
- Curl_safefree(str_utf8);
+ free(str_utf8);
+ return NULL;
}
}
}
diff --git a/lib/curl_ntlm.c b/lib/curl_ntlm.c
index 241bc09e4..1bc509d7e 100644
--- a/lib/curl_ntlm.c
+++ b/lib/curl_ntlm.c
@@ -173,7 +173,7 @@ CURLcode Curl_output_ntlm(struct connectdata *conn, bool proxy)
return result;
if(base64) {
- Curl_safefree(*allocuserpwd);
+ free(*allocuserpwd);
*allocuserpwd = aprintf("%sAuthorization: NTLM %s\r\n",
proxy ? "Proxy-" : "",
base64);
@@ -193,7 +193,7 @@ CURLcode Curl_output_ntlm(struct connectdata *conn, bool proxy)
return result;
if(base64) {
- Curl_safefree(*allocuserpwd);
+ free(*allocuserpwd);
*allocuserpwd = aprintf("%sAuthorization: NTLM %s\r\n",
proxy ? "Proxy-" : "",
base64);
diff --git a/lib/curl_ntlm_core.c b/lib/curl_ntlm_core.c
index 5b88fc5a0..a77f42da0 100644
--- a/lib/curl_ntlm_core.c
+++ b/lib/curl_ntlm_core.c
@@ -618,7 +618,7 @@ CURLcode Curl_ntlm_core_mk_ntlmv2_hash(const char *user, size_t userlen,
result = Curl_hmac_md5(ntlmhash, 16, identity, curlx_uztoui(identity_len),
ntlmv2hash);
- Curl_safefree(identity);
+ free(identity);
return result;
}
@@ -705,8 +705,7 @@ CURLcode Curl_ntlm_core_mk_ntlmv2_resp(unsigned char *ntlmv2hash,
result = Curl_hmac_md5(ntlmv2hash, NTLM_HMAC_MD5_LEN, ptr + 8,
NTLMv2_BLOB_LEN + 8, hmac_output);
if(result) {
- Curl_safefree(ptr);
-
+ free(ptr);
return result;
}
diff --git a/lib/curl_ntlm_msgs.c b/lib/curl_ntlm_msgs.c
index 743d067be..3161b3888 100644
--- a/lib/curl_ntlm_msgs.c
+++ b/lib/curl_ntlm_msgs.c
@@ -758,7 +758,7 @@ CURLcode Curl_sasl_create_ntlm_type3_message(struct SessionHandle *data,
ntlm_print_hex(stderr, (char *)&ntlmbuf[ntrespoff], ntresplen);
});
- Curl_safefree(ntlmv2resp);/* Free the dynamic buffer allocated for NTLMv2 */
+ free(ntlmv2resp);/* Free the dynamic buffer allocated for NTLMv2 */
#endif
diff --git a/lib/curl_ntlm_wb.c b/lib/curl_ntlm_wb.c
index c5288446f..53681a0d5 100644
--- a/lib/curl_ntlm_wb.c
+++ b/lib/curl_ntlm_wb.c
@@ -105,9 +105,9 @@ void Curl_ntlm_wb_cleanup(struct connectdata *conn)
conn->ntlm_auth_hlpr_pid = 0;
}
- Curl_safefree(conn->challenge_header);
+ free(conn->challenge_header);
conn->challenge_header = NULL;
- Curl_safefree(conn->response_header);
+ free(conn->response_header);
conn->response_header = NULL;
}
@@ -244,13 +244,13 @@ static CURLcode ntlm_wb_init(struct connectdata *conn, const char *userp)
sclose(sockfds[1]);
conn->ntlm_auth_hlpr_socket = sockfds[0];
conn->ntlm_auth_hlpr_pid = child_pid;
- Curl_safefree(domain);
- Curl_safefree(ntlm_auth_alloc);
+ free(domain);
+ free(ntlm_auth_alloc);
return CURLE_OK;
done:
- Curl_safefree(domain);
- Curl_safefree(ntlm_auth_alloc);
+ free(domain);
+ free(ntlm_auth_alloc);
return CURLE_REMOTE_ACCESS_DENIED;
}
@@ -389,12 +389,12 @@ CURLcode Curl_output_ntlm_wb(struct connectdata *conn,
if(res)
return res;
- Curl_safefree(*allocuserpwd);
+ free(*allocuserpwd);
*allocuserpwd = aprintf("%sAuthorization: %s\r\n",
proxy ? "Proxy-" : "",
conn->response_header);
DEBUG_OUT(fprintf(stderr, "**** Header %s\n ", *allocuserpwd));
- Curl_safefree(conn->response_header);
+ free(conn->response_header);
conn->response_header = NULL;
break;
case NTLMSTATE_TYPE2:
@@ -407,7 +407,7 @@ CURLcode Curl_output_ntlm_wb(struct connectdata *conn,
if(res)
return res;
- Curl_safefree(*allocuserpwd);
+ free(*allocuserpwd);
*allocuserpwd = aprintf("%sAuthorization: %s\r\n",
proxy ? "Proxy-" : "",
conn->response_header);
diff --git a/lib/curl_sasl.c b/lib/curl_sasl.c
index 4c299e701..f192fddac 100644
--- a/lib/curl_sasl.c
+++ b/lib/curl_sasl.c
@@ -251,7 +251,7 @@ static CURLcode sasl_digest_get_qop_values(const char *options, int *value)
token = strtok_r(NULL, ",", &tok_buf);
}
- Curl_safefree(tmp);
+ free(tmp);
return CURLE_OK;
}
@@ -324,7 +324,7 @@ static CURLcode sasl_create_plain_message(struct SessionHandle *data,
/* Base64 encode the reply */
result = Curl_base64_encode(data, plainauth, 2 * ulen + plen + 2, outptr,
outlen);
- Curl_safefree(plainauth);
+ free(plainauth);
return result;
}
@@ -481,7 +481,7 @@ static CURLcode sasl_create_cram_md5_message(struct SessionHandle *data,
/* Base64 encode the response */
result = Curl_base64_encode(data, response, 0, outptr, outlen);
- Curl_safefree(response);
+ free(response);
return result;
}
@@ -531,7 +531,7 @@ static CURLcode sasl_decode_digest_md5_message(const char *chlg64,
/* Retrieve nonce string from the challenge */
if(!sasl_digest_get_key_value((char *)chlg, "nonce=\"", nonce, nlen, '\"')) {
- Curl_safefree(chlg);
+ free(chlg);
return CURLE_BAD_CONTENT_ENCODING;
}
@@ -543,17 +543,17 @@ static CURLcode sasl_decode_digest_md5_message(const char *chlg64,
/* Retrieve algorithm string from the challenge */
if(!sasl_digest_get_key_value((char *)chlg, "algorithm=", alg, alen, ',')) {
- Curl_safefree(chlg);
+ free(chlg);
return CURLE_BAD_CONTENT_ENCODING;
}
/* Retrieve qop-options string from the challenge */
if(!sasl_digest_get_key_value((char *)chlg, "qop=\"", qop, qlen, '\"')) {
- Curl_safefree(chlg);
+ free(chlg);
return CURLE_BAD_CONTENT_ENCODING;
}
- Curl_safefree(chlg);
+ free(chlg);
return CURLE_OK;
}
@@ -675,7 +675,7 @@ CURLcode Curl_sasl_create_digest_md5_message(struct SessionHandle *data,
/* Calculate H(A2) */
ctxt = Curl_MD5_init(Curl_DIGEST_MD5);
if(!ctxt) {
- Curl_safefree(spn);
+ free(spn);
return CURLE_OUT_OF_MEMORY;
}
@@ -693,7 +693,7 @@ CURLcode Curl_sasl_create_digest_md5_message(struct SessionHandle *data,
/* Now calculate the response hash */
ctxt = Curl_MD5_init(Curl_DIGEST_MD5);
if(!ctxt) {
- Curl_safefree(spn);
+ free(spn);
return CURLE_OUT_OF_MEMORY;
}
@@ -726,14 +726,14 @@ CURLcode Curl_sasl_create_digest_md5_message(struct SessionHandle *data,
"qop=%s",
userp, realm, nonce,
cnonce, nonceCount, spn, resp_hash_hex, qop);
- Curl_safefree(spn);
+ free(spn);
if(!response)
return CURLE_OUT_OF_MEMORY;
/* Base64 encode the response */
result = Curl_base64_encode(data, response, 0, outptr, outlen);
- Curl_safefree(response);
+ free(response);
return result;
}
@@ -947,7 +947,7 @@ CURLcode Curl_sasl_create_digest_http_message(struct SessionHandle *data,
CURL_OUTPUT_DIGEST_CONV(data, md5this); /* convert on non-ASCII machines */
Curl_md5it(md5buf, md5this);
- Curl_safefree(md5this);
+ free(md5this);
sasl_digest_md5_to_ascii(md5buf, ha1);
if(digest->algo == CURLDIGESTALGO_MD5SESS) {
@@ -958,7 +958,7 @@ CURLcode Curl_sasl_create_digest_http_message(struct SessionHandle *data,
CURL_OUTPUT_DIGEST_CONV(data, tmp); /* convert on non-ASCII machines */
Curl_md5it(md5buf, (unsigned char *)tmp);
- Curl_safefree(tmp);
+ free(tmp);
sasl_digest_md5_to_ascii(md5buf, ha1);
}
@@ -982,7 +982,7 @@ CURLcode Curl_sasl_create_digest_http_message(struct SessionHandle *data,
TODO: replace md5 of empty string with entity-body for PUT/POST */
unsigned char *md5this2 = (unsigned char *)
aprintf("%s:%s", md5this, "d41d8cd98f00b204e9800998ecf8427e");
- Curl_safefree(md5this);
+ free(md5this);
md5this = md5this2;
}
@@ -991,7 +991,7 @@ CURLcode Curl_sasl_create_digest_http_message(struct SessionHandle *data,
CURL_OUTPUT_DIGEST_CONV(data, md5this); /* convert on non-ASCII machines */
Curl_md5it(md5buf, md5this);
- Curl_safefree(md5this);
+ free(md5this);
sasl_digest_md5_to_ascii(md5buf, ha2);
if(digest->qop) {
@@ -1015,7 +1015,7 @@ CURLcode Curl_sasl_create_digest_http_message(struct SessionHandle *data,
CURL_OUTPUT_DIGEST_CONV(data, md5this); /* convert on non-ASCII machines */
Curl_md5it(md5buf, md5this);
- Curl_safefree(md5this);
+ free(md5this);
sasl_digest_md5_to_ascii(md5buf, request_digest);
/* for test case 64 (snooped from a Mozilla 1.3a request)
@@ -1070,7 +1070,7 @@ CURLcode Curl_sasl_create_digest_http_message(struct SessionHandle *data,
uripath,
request_digest);
}
- Curl_safefree(userp_quoted);
+ free(userp_quoted);
if(!response)
return CURLE_OUT_OF_MEMORY;
@@ -1183,7 +1183,7 @@ static CURLcode sasl_create_xoauth2_message(struct SessionHandle *data,
/* Base64 encode the reply */
result = Curl_base64_encode(data, xoauth, strlen(xoauth), outptr, outlen);
- Curl_safefree(xoauth);
+ free(xoauth);
return result;
}
@@ -1474,7 +1474,7 @@ CURLcode Curl_sasl_start(struct SASL *sasl, struct connectdata *conn,
if(!result) {
if(resp && sasl->params->maxirlen &&
strlen(mech) + len > sasl->params->maxirlen) {
- Curl_safefree(resp);
+ free(resp);
resp = NULL;
}
@@ -1487,7 +1487,7 @@ CURLcode Curl_sasl_start(struct SASL *sasl, struct connectdata *conn,
}
}
- Curl_safefree(resp);
+ free(resp);
return result;
}
@@ -1553,7 +1553,7 @@ CURLcode Curl_sasl_continue(struct SASL *sasl, struct connectdata *conn,
if(!result)
result = sasl_create_cram_md5_message(data, chlg, conn->user,
conn->passwd, &resp, &len);
- Curl_safefree(chlg);
+ free(chlg);
break;
case SASL_DIGESTMD5:
sasl->params->getmessage(data->state.buffer, &serverdata);
@@ -1659,7 +1659,7 @@ CURLcode Curl_sasl_continue(struct SASL *sasl, struct connectdata *conn,
break;
}
- Curl_safefree(resp);
+ free(resp);
state(sasl, conn, newstate);
diff --git a/lib/curl_sasl_gssapi.c b/lib/curl_sasl_gssapi.c
index fcda39dd0..81d241bb0 100644
--- a/lib/curl_sasl_gssapi.c
+++ b/lib/curl_sasl_gssapi.c
@@ -120,12 +120,12 @@ CURLcode Curl_sasl_create_gssapi_user_message(struct SessionHandle *data,
if(GSS_ERROR(gss_major_status)) {
Curl_gss_log_error(data, gss_minor_status, "gss_import_name() failed: ");
- Curl_safefree(spn);
+ free(spn);
return CURLE_OUT_OF_MEMORY;
}
- Curl_safefree(spn);
+ free(spn);
}
else {
/* Decode the base-64 encoded challenge message */
@@ -158,7 +158,7 @@ CURLcode Curl_sasl_create_gssapi_user_message(struct SessionHandle *data,
mutual_auth,
NULL);
- Curl_safefree(input_token.value);
+ free(input_token.value);
if(GSS_ERROR(gss_major_status)) {
if(output_token.value)
@@ -244,7 +244,7 @@ CURLcode Curl_sasl_create_gssapi_security_message(struct SessionHandle *data,
Curl_gss_log_error(data, gss_minor_status,
"gss_inquire_context() failed: ");
- Curl_safefree(chlg);
+ free(chlg);
return CURLE_OUT_OF_MEMORY;
}
@@ -255,7 +255,7 @@ CURLcode Curl_sasl_create_gssapi_security_message(struct SessionHandle *data,
if(GSS_ERROR(gss_major_status)) {
Curl_gss_log_error(data, gss_minor_status, "gss_display_name() failed: ");
- Curl_safefree(chlg);
+ free(chlg);
return CURLE_OUT_OF_MEMORY;
}
@@ -271,7 +271,7 @@ CURLcode Curl_sasl_create_gssapi_security_message(struct SessionHandle *data,
Curl_gss_log_error(data, gss_minor_status, "gss_unwrap() failed: ");
gss_release_buffer(&gss_status, &username_token);
- Curl_safefree(chlg);
+ free(chlg);
return CURLE_BAD_CONTENT_ENCODING;
}
@@ -281,7 +281,7 @@ CURLcode Curl_sasl_create_gssapi_security_message(struct SessionHandle *data,
infof(data, "GSSAPI handshake failure (invalid security data)\n");
gss_release_buffer(&gss_status, &username_token);
- Curl_safefree(chlg);
+ free(chlg);
return CURLE_BAD_CONTENT_ENCODING;
}
@@ -289,7 +289,7 @@ CURLcode Curl_sasl_create_gssapi_security_message(struct SessionHandle *data,
/* Copy the data out and free the challenge as it is not required anymore */
memcpy(&indata, output_token.value, 4);
gss_release_buffer(&gss_status, &output_token);
- Curl_safefree(chlg);
+ free(chlg);
/* Extract the security layer */
sec_layer = indata & 0x000000FF;
@@ -344,7 +344,7 @@ CURLcode Curl_sasl_create_gssapi_security_message(struct SessionHandle *data,
if(GSS_ERROR(gss_major_status)) {
Curl_gss_log_error(data, gss_minor_status, "gss_wrap() failed: ");
- Curl_safefree(message);
+ free(message);
return CURLE_OUT_OF_MEMORY;
}
@@ -357,7 +357,7 @@ CURLcode Curl_sasl_create_gssapi_security_message(struct SessionHandle *data,
gss_release_buffer(&gss_status, &output_token);
/* Free the message buffer */
- Curl_safefree(message);
+ free(message);
return result;
}
diff --git a/lib/curl_sasl_sspi.c b/lib/curl_sasl_sspi.c
index 546c2c8bd..238d74b7e 100644
--- a/lib/curl_sasl_sspi.c
+++ b/lib/curl_sasl_sspi.c
@@ -78,7 +78,7 @@ TCHAR *Curl_sasl_build_spn(const char *service, const char *host)
/* Allocate our TCHAR based SPN */
tchar_spn = Curl_convert_UTF8_to_tchar(utf8_spn);
if(!tchar_spn) {
- Curl_safefree(utf8_spn);
+ free(utf8_spn);
return NULL;
}
@@ -154,7 +154,7 @@ CURLcode Curl_sasl_create_digest_md5_message(struct SessionHandle *data,
status = s_pSecFn->QuerySecurityPackageInfo((TCHAR *) TEXT(SP_NAME_DIGEST),
&SecurityPackage);
if(status != SEC_E_OK) {
- Curl_safefree(input_token);
+ free(input_token);
return CURLE_NOT_BUILT_IN;
}
@@ -167,7 +167,7 @@ CURLcode Curl_sasl_create_digest_md5_message(struct SessionHandle *data,
/* Allocate our response buffer */
output_token = malloc(token_max);
if(!output_token) {
- Curl_safefree(input_token);
+ free(input_token);
return CURLE_OUT_OF_MEMORY;
}
@@ -175,8 +175,8 @@ CURLcode Curl_sasl_create_digest_md5_message(struct SessionHandle *data,
/* Generate our SPN */
spn = Curl_sasl_build_spn(service, data->easy_conn->host.name);
if(!spn) {
- Curl_safefree(output_token);
- Curl_safefree(input_token);
+ free(output_token);
+ free(input_token);
return CURLE_OUT_OF_MEMORY;
}
@@ -185,9 +185,9 @@ CURLcode Curl_sasl_create_digest_md5_message(struct SessionHandle *data,
/* Populate our identity structure */
result = Curl_create_sspi_identity(userp, passwdp, &identity);
if(result) {
- Curl_safefree(spn);
- Curl_safefree(output_token);
- Curl_safefree(input_token);
+ free(spn);
+ free(output_token);
+ free(input_token);
return result;
}
@@ -208,9 +208,9 @@ CURLcode Curl_sasl_create_digest_md5_message(struct SessionHandle *data,
if(status != SEC_E_OK) {
Curl_sspi_free_identity(p_identity);
- Curl_safefree(spn);
- Curl_safefree(output_token);
- Curl_safefree(input_token);
+ free(spn);
+ free(output_token);
+ free(input_token);
return CURLE_LOGIN_DENIED;
}
@@ -243,9 +243,9 @@ CURLcode Curl_sasl_create_digest_md5_message(struct SessionHandle *data,
else if(status != SEC_E_OK && status != SEC_I_CONTINUE_NEEDED) {
s_pSecFn->FreeCredentialsHandle(&credentials);
Curl_sspi_free_identity(p_identity);
- Curl_safefree(spn);
- Curl_safefree(output_token);
- Curl_safefree(input_token);
+ free(spn);
+ free(output_token);
+ free(input_token);
return CURLE_RECV_ERROR;
}
@@ -262,13 +262,13 @@ CURLcode Curl_sasl_create_digest_md5_message(struct SessionHandle *data,
Curl_sspi_free_identity(p_identity);
/* Free the SPN */
- Curl_safefree(spn);
+ free(spn);
/* Free the response buffer */
- Curl_safefree(output_token);
+ free(output_token);
/* Free the decoded challenge message */
- Curl_safefree(input_token);
+ free(input_token);
return result;
}
@@ -388,7 +388,7 @@ CURLcode Curl_sasl_create_digest_http_message(struct SessionHandle *data,
p_identity, NULL, NULL,
&credentials, &expiry);
if(status != SEC_E_OK) {
- Curl_safefree(output_token);
+ free(output_token);
return CURLE_LOGIN_DENIED;
}
@@ -428,7 +428,7 @@ CURLcode Curl_sasl_create_digest_http_message(struct SessionHandle *data,
else if(status != SEC_E_OK && status != SEC_I_CONTINUE_NEEDED) {
s_pSecFn->FreeCredentialsHandle(&credentials);
- Curl_safefree(output_token);
+ free(output_token);
return CURLE_OUT_OF_MEMORY;
}
@@ -438,7 +438,7 @@ CURLcode Curl_sasl_create_digest_http_message(struct SessionHandle *data,
s_pSecFn->DeleteSecurityContext(&context);
s_pSecFn->FreeCredentialsHandle(&credentials);
- Curl_safefree(output_token);
+ free(output_token);
return CURLE_OUT_OF_MEMORY;
}
@@ -459,7 +459,7 @@ CURLcode Curl_sasl_create_digest_http_message(struct SessionHandle *data,
Curl_sspi_free_identity(p_identity);
/* Free the response buffer */
- Curl_safefree(output_token);
+ free(output_token);
return CURLE_OK;
}
@@ -910,7 +910,7 @@ CURLcode Curl_sasl_create_gssapi_user_message(struct SessionHandle *data,
&expiry);
if(status != SEC_E_OK && status != SEC_I_CONTINUE_NEEDED) {
- Curl_safefree(chlg);
+ free(chlg);
return CURLE_RECV_ERROR;
}
@@ -928,7 +928,7 @@ CURLcode Curl_sasl_create_gssapi_user_message(struct SessionHandle *data,
}
/* Free the decoded challenge */
- Curl_safefree(chlg);
+ free(chlg);
return result;
}
@@ -999,7 +999,7 @@ CURLcode Curl_sasl_create_gssapi_security_message(struct SessionHandle *data,
SECPKG_ATTR_SIZES,
&sizes);
if(status != SEC_E_OK) {
- Curl_safefree(chlg);
+ free(chlg);
return CURLE_OUT_OF_MEMORY;
}
@@ -1009,7 +1009,7 @@ CURLcode Curl_sasl_create_gssapi_security_message(struct SessionHandle *data,
SECPKG_CRED_ATTR_NAMES,
&names);
if(status != SEC_E_OK) {
- Curl_safefree(chlg);
+ free(chlg);
return CURLE_RECV_ERROR;
}
@@ -1030,7 +1030,7 @@ CURLcode Curl_sasl_create_gssapi_security_message(struct SessionHandle *data,
if(status != SEC_E_OK) {
infof(data, "GSSAPI handshake failure (empty security message)\n");
- Curl_safefree(chlg);
+ free(chlg);
return CURLE_BAD_CONTENT_ENCODING;
}
@@ -1039,7 +1039,7 @@ CURLcode Curl_sasl_create_gssapi_security_message(struct SessionHandle *data,
if(input_buf[1].cbBuffer != 4) {
infof(data, "GSSAPI handshake failure (invalid security data)\n");
- Curl_safefree(chlg);
+ free(chlg);
return CURLE_BAD_CONTENT_ENCODING;
}
@@ -1047,7 +1047,7 @@ CURLcode Curl_sasl_create_gssapi_security_message(struct SessionHandle *data,
/* Copy the data out and free the challenge as it is not required anymore */
memcpy(&indata, input_buf[1].pvBuffer, 4);
s_pSecFn->FreeContextBuffer(input_buf[1].pvBuffer);
- Curl_safefree(chlg);
+ free(chlg);
/* Extract the security layer */
sec_layer = indata & 0x000000FF;
@@ -1074,7 +1074,7 @@ CURLcode Curl_sasl_create_gssapi_security_message(struct SessionHandle *data,
/* Convert the user name to UTF8 when operating with Unicode */
user_name = Curl_convert_tchar_to_UTF8(names.sUserName);
if(!user_name) {
- Curl_safefree(trailer);
+ free(trailer);
return CURLE_OUT_OF_MEMORY;
}
@@ -1083,7 +1083,7 @@ CURLcode Curl_sasl_create_gssapi_security_message(struct SessionHandle *data,
messagelen = sizeof(outdata) + strlen(user_name) + 1;
message = malloc(messagelen);
if(!message) {
- Curl_safefree(trailer);
+ free(trailer);
Curl_unicodefree(user_name);
return CURLE_OUT_OF_MEMORY;
@@ -1102,8 +1102,8 @@ CURLcode Curl_sasl_create_gssapi_security_message(struct SessionHandle *data,
/* Allocate the padding */
padding = malloc(sizes.cbBlockSize);
if(!padding) {
- Curl_safefree(message);
- Curl_safefree(trailer);
+ free(message);
+ free(trailer);
return CURLE_OUT_OF_MEMORY;
}
@@ -1126,9 +1126,9 @@ CURLcode Curl_sasl_create_gssapi_security_message(struct SessionHandle *data,
status = s_pSecFn->EncryptMessage(krb5->context, KERB_WRAP_NO_ENCRYPT,
&wrap_desc, 0);
if(status != SEC_E_OK) {
- Curl_safefree(padding);
- Curl_safefree(message);
- Curl_safefree(trailer);
+ free(padding);
+ free(message);
+ free(trailer);
return CURLE_OUT_OF_MEMORY;
}
@@ -1138,9 +1138,9 @@ CURLcode Curl_sasl_create_gssapi_security_message(struct SessionHandle *data,
wrap_buf[2].cbBuffer;
appdata = malloc(appdatalen);
if(!appdata) {
- Curl_safefree(padding);
- Curl_safefree(message);
- Curl_safefree(trailer);
+ free(padding);
+ free(message);
+ free(trailer);
return CURLE_OUT_OF_MEMORY;
}
@@ -1157,10 +1157,10 @@ CURLcode Curl_sasl_create_gssapi_security_message(struct SessionHandle *data,
outlen);
/* Free all of our local buffers */
- Curl_safefree(appdata);
- Curl_safefree(padding);
- Curl_safefree(message);
- Curl_safefree(trailer);
+ free(appdata);
+ free(padding);
+ free(message);
+ free(trailer);
return result;
}
diff --git a/lib/curl_threads.c b/lib/curl_threads.c
index eba540bd4..f9b812ea0 100644
--- a/lib/curl_threads.c
+++ b/lib/curl_threads.c
@@ -73,8 +73,8 @@ curl_thread_t Curl_thread_create(unsigned int (*func) (void*), void *arg)
return t;
err:
- Curl_safefree(t);
- Curl_safefree(ac);
+ free(t);
+ free(ac);
return curl_thread_t_null;
}
diff --git a/lib/formdata.c b/lib/formdata.c
index 3076a1437..7299aa123 100644
--- a/lib/formdata.c
+++ b/lib/formdata.c
@@ -415,7 +415,7 @@ CURLFORMcode FormAdd(struct curl_httppost **httppost,
else {
form = AddFormInfo(fname, NULL, current_form);
if(!form) {
- Curl_safefree(fname);
+ free(fname);
return_value = CURL_FORMADD_MEMORY;
}
else {
@@ -504,7 +504,7 @@ CURLFORMcode FormAdd(struct curl_httppost **httppost,
else {
form = AddFormInfo(NULL, type, current_form);
if(!form) {
- Curl_safefree(type);
+ free(type);
return_value = CURL_FORMADD_MEMORY;
}
else {
@@ -711,7 +711,7 @@ CURLFORMcode FormAdd(struct curl_httppost **httppost,
now by the httppost linked list */
while(first_form) {
FormInfo *ptr = first_form->more;
- Curl_safefree(first_form);
+ free(first_form);
first_form = ptr;
}
@@ -1068,7 +1068,7 @@ static CURLcode formdata_add_filename(const struct curl_httppost *file,
/* filename need be escaped */
filename_escaped = malloc(strlen(filename)*2+1);
if(!filename_escaped) {
- Curl_safefree(filebasename);
+ free(filebasename);
return CURLE_OUT_OF_MEMORY;
}
p0 = filename_escaped;
@@ -1084,8 +1084,8 @@ static CURLcode formdata_add_filename(const struct curl_httppost *file,
result = AddFormDataf(form, size,
"; filename=\"%s\"",
filename);
- Curl_safefree(filename_escaped);
- Curl_safefree(filebasename);
+ free(filename_escaped);
+ free(filebasename);
return result;
}
@@ -1135,7 +1135,7 @@ CURLcode Curl_getformdata(struct SessionHandle *data,
boundary);
if(result) {
- Curl_safefree(boundary);
+ free(boundary);
return result;
}
/* we DO NOT include that line in the total size of the POST, since it'll be
@@ -1178,7 +1178,7 @@ CURLcode Curl_getformdata(struct SessionHandle *data,
/* If used, this is a link to more file names, we must then do
the magic to include several files with the same field name */
- Curl_safefree(fileboundary);
+ free(fileboundary);
fileboundary = formboundary(data);
if(!fileboundary) {
result = CURLE_OUT_OF_MEMORY;
@@ -1331,15 +1331,15 @@ CURLcode Curl_getformdata(struct SessionHandle *data,
if(result) {
Curl_formclean(&firstform);
- Curl_safefree(fileboundary);
- Curl_safefree(boundary);
+ free(fileboundary);
+ free(boundary);
return result;
}
*sizep = size;
- Curl_safefree(fileboundary);
- Curl_safefree(boundary);
+ free(fileboundary);
+ free(boundary);
*finalform = firstform;
diff --git a/lib/ftp.c b/lib/ftp.c
index 461045606..337755955 100644
--- a/lib/ftp.c
+++ b/lib/ftp.c
@@ -1101,7 +1101,7 @@ static CURLcode ftp_state_use_port(struct connectdata *conn,
if(getsockname(conn->sock[FIRSTSOCKET], sa, &sslen)) {
failf(data, "getsockname() failed: %s",
Curl_strerror(conn, SOCKERRNO) );
- Curl_safefree(addr);
+ free(addr);
return CURLE_FTP_PORT_FAILED;
}
switch(sa->sa_family) {
@@ -1133,11 +1133,11 @@ static CURLcode ftp_state_use_port(struct connectdata *conn,
if(res == NULL) {
failf(data, "failed to resolve the address provided to PORT: %s", host);
- Curl_safefree(addr);
+ free(addr);
return CURLE_FTP_PORT_FAILED;
}
- Curl_safefree(addr);
+ free(addr);
host = NULL;
/* step 2, create a socket for the requested address */
@@ -3807,7 +3807,7 @@ static void wc_data_dtor(void *ptr)
struct ftp_wc_tmpdata *tmp = ptr;
if(tmp)
Curl_ftp_parselist_data_free(&tmp->parser);
- Curl_safefree(tmp);
+ free(tmp);
}
static CURLcode init_wc_data(struct connectdata *conn)
@@ -3861,7 +3861,7 @@ static CURLcode init_wc_data(struct connectdata *conn)
ftp_tmp->parser = Curl_ftp_parselist_data_alloc();
if(!ftp_tmp->parser) {
Curl_safefree(wildcard->pattern);
- Curl_safefree(ftp_tmp);
+ free(ftp_tmp);
return CURLE_OUT_OF_MEMORY;
}
diff --git a/lib/gopher.c b/lib/gopher.c
index 18d100f43..954cad8e0 100644
--- a/lib/gopher.c
+++ b/lib/gopher.c
@@ -120,7 +120,7 @@ static CURLcode gopher_do(struct connectdata *conn, bool *done)
if(!result) { /* Which may not have written it all! */
result = Curl_client_write(conn, CLIENTWRITE_HEADER, sel, amount);
if(result) {
- Curl_safefree(sel_org);
+ free(sel_org);
return result;
}
k -= amount;
@@ -130,7 +130,7 @@ static CURLcode gopher_do(struct connectdata *conn, bool *done)
}
else {
failf(data, "Failed sending Gopher request");
- Curl_safefree(sel_org);
+ free(sel_org);
return result;
}
/* Don't busyloop. The entire loop thing is a work-around as it causes a
@@ -145,7 +145,7 @@ static CURLcode gopher_do(struct connectdata *conn, bool *done)
Curl_socket_ready(CURL_SOCKET_BAD, sockfd, 100);
}
- Curl_safefree(sel_org);
+ free(sel_org);
/* We can use Curl_sendf to send the terminal \r\n relatively safely and
save allocing another string/doing another _write loop. */
diff --git a/lib/http.c b/lib/http.c
index 2ad330592..0c08204f2 100644
--- a/lib/http.c
+++ b/lib/http.c
@@ -301,7 +301,7 @@ static CURLcode http_output_basic(struct connectdata *conn, bool proxy)
if(!authorization)
return CURLE_REMOTE_ACCESS_DENIED;
- Curl_safefree(*userp);
+ free(*userp);
*userp = aprintf("%sAuthorization: Basic %s\r\n",
proxy?"Proxy-":"",
authorization);
@@ -3483,7 +3483,7 @@ CURLcode Curl_http_readwrite_headers(struct SessionHandle *data,
if(Curl_pipeline_server_blacklisted(data, server_name))
conn->bundle->server_supports_pipelining = FALSE;
}
- Curl_safefree(server_name);
+ free(server_name);
}
else if((conn->httpversion == 10) &&
conn->bits.httpproxy &&
@@ -3688,7 +3688,7 @@ CURLcode Curl_http_readwrite_headers(struct SessionHandle *data,
result = Curl_http_input_auth(conn, proxy, auth);
- Curl_safefree(auth);
+ free(auth);
if(result)
return result;
diff --git a/lib/http2.c b/lib/http2.c
index ea20b0a11..66a0adbc0 100644
--- a/lib/http2.c
+++ b/lib/http2.c
@@ -669,7 +669,7 @@ CURLcode Curl_http2_request_upgrade(Curl_send_buffer *req,
"Upgrade: %s\r\n"
"HTTP2-Settings: %s\r\n",
NGHTTP2_CLEARTEXT_PROTO_VERSION_ID, base64);
- Curl_safefree(base64);
+ free(base64);
k->upgr101 = UPGR101_REQUESTED;
@@ -945,7 +945,7 @@ static ssize_t http2_send(struct connectdata *conn, int sockindex,
NULL, NULL);
}
- Curl_safefree(nva);
+ free(nva);
if(stream_id < 0) {
*err = CURLE_SEND_ERROR;
diff --git a/lib/http_negotiate.c b/lib/http_negotiate.c
index 89c01f768..1c840fe03 100644
--- a/lib/http_negotiate.c
+++ b/lib/http_negotiate.c
@@ -78,12 +78,12 @@ CURLcode Curl_input_negotiate(struct connectdata *conn, bool proxy,
if(GSS_ERROR(major_status)) {
Curl_gss_log_error(data, minor_status, "gss_import_name() failed: ");
- Curl_safefree(spn);
+ free(spn);
return CURLE_OUT_OF_MEMORY;
}
- Curl_safefree(spn);
+ free(spn);
}
header += strlen("Negotiate");
@@ -179,7 +179,7 @@ CURLcode Curl_output_negotiate(struct connectdata *conn, bool proxy)
conn->allocptr.userpwd = userp;
}
- Curl_safefree(encoded);
+ free(encoded);
return (userp == NULL) ? CURLE_OUT_OF_MEMORY : CURLE_OK;
}
diff --git a/lib/http_negotiate_sspi.c b/lib/http_negotiate_sspi.c
index 1dc3b3501..d3c028c17 100644
--- a/lib/http_negotiate_sspi.c
+++ b/lib/http_negotiate_sspi.c
@@ -207,7 +207,7 @@ CURLcode Curl_input_negotiate(struct connectdata *conn, bool proxy,
&attrs,
&expiry);
- Curl_safefree(input_token);
+ free(input_token);
if(GSS_ERROR(neg_ctx->status))
return CURLE_OUT_OF_MEMORY;
diff --git a/lib/http_proxy.c b/lib/http_proxy.c
index 85ef1a2cc..f3c54bd78 100644
--- a/lib/http_proxy.c
+++ b/lib/http_proxy.c
@@ -212,7 +212,7 @@ CURLcode Curl_proxyCONNECT(struct connectdata *conn,
failf(data, "Failed sending CONNECT to proxy");
}
- Curl_safefree(req_buffer);
+ free(req_buffer);
if(result)
return result;
@@ -463,7 +463,7 @@ CURLcode Curl_proxyCONNECT(struct connectdata *conn,
result = Curl_http_input_auth(conn, proxy, auth);
- Curl_safefree(auth);
+ free(auth);
if(result)
return result;
diff --git a/lib/imap.c b/lib/imap.c
index 6db221bc1..e6d83f2cf 100644
--- a/lib/imap.c
+++ b/lib/imap.c
@@ -547,8 +547,8 @@ static CURLcode imap_perform_login(struct connectdata *conn)
result = imap_sendf(conn, "LOGIN %s %s", user ? user : "",
passwd ? passwd : "");
- Curl_safefree(user);
- Curl_safefree(passwd);
+ free(user);
+ free(passwd);
if(!result)
state(conn, IMAP_LOGIN);
@@ -661,7 +661,7 @@ static CURLcode imap_perform_list(struct connectdata *conn)
/* Send the LIST command */
result = imap_sendf(conn, "LIST \"%s\" *", mailbox);
- Curl_safefree(mailbox);
+ free(mailbox);
}
if(!result)
@@ -702,7 +702,7 @@ static CURLcode imap_perform_select(struct connectdata *conn)
/* Send the SELECT command */
result = imap_sendf(conn, "SELECT %s", mailbox);
- Curl_safefree(mailbox);
+ free(mailbox);
if(!result)
state(conn, IMAP_SELECT);
@@ -777,7 +777,7 @@ static CURLcode imap_perform_append(struct connectdata *conn)
result = imap_sendf(conn, "APPEND %s (\\Seen) {%" CURL_FORMAT_CURL_OFF_T "}",
mailbox, conn->data->state.infilesize);
- Curl_safefree(mailbox);
+ free(mailbox);
if(!result)
state(conn, IMAP_APPEND);
@@ -1800,7 +1800,7 @@ static CURLcode imap_sendf(struct connectdata *conn, const char *fmt, ...)
result = Curl_pp_vsendf(&imapc->pp, taggedfmt, ap);
va_end(ap);
- Curl_safefree(taggedfmt);
+ free(taggedfmt);
return result;
}
@@ -2031,7 +2031,7 @@ static CURLcode imap_parse_url_path(struct connectdata *conn)
/* Decode the value parameter */
result = Curl_urldecode(data, begin, ptr - begin, &value, &valuelen, TRUE);
if(result) {
- Curl_safefree(name);
+ free(name);
return result;
}
@@ -2070,14 +2070,14 @@ static CURLcode imap_parse_url_path(struct connectdata *conn)
value = NULL;
}
else {
- Curl_safefree(name);
- Curl_safefree(value);
+ free(name);
+ free(value);
return CURLE_URL_MALFORMAT;
}
- Curl_safefree(name);
- Curl_safefree(value);
+ free(name);
+ free(value);
}
/* Does the URL contain a query parameter? Only valid when we have a mailbox
diff --git a/lib/ldap.c b/lib/ldap.c
index 8434f7896..6ad66ff4d 100644
--- a/lib/ldap.c
+++ b/lib/ldap.c
@@ -852,7 +852,7 @@ static int _ldap_url_parse2 (const struct connectdata *conn, LDAPURLDesc *ludp)
ludp->lud_attrs = calloc(count + 1, sizeof(char *));
#endif
if(!ludp->lud_attrs) {
- Curl_safefree(attributes);
+ free(attributes);
rc = LDAP_NO_MEMORY;
@@ -867,7 +867,7 @@ static int _ldap_url_parse2 (const struct connectdata *conn, LDAPURLDesc *ludp)
/* Unescape the attribute */
unescaped = curl_easy_unescape(conn->data, attributes[i], 0, NULL);
if(!unescaped) {
- Curl_safefree(attributes);
+ free(attributes);
rc = LDAP_NO_MEMORY;
@@ -882,7 +882,7 @@ static int _ldap_url_parse2 (const struct connectdata *conn, LDAPURLDesc *ludp)
Curl_unicodefree(unescaped);
if(!ludp->lud_attrs[i]) {
- Curl_safefree(attributes);
+ free(attributes);
rc = LDAP_NO_MEMORY;
@@ -895,7 +895,7 @@ static int _ldap_url_parse2 (const struct connectdata *conn, LDAPURLDesc *ludp)
ludp->lud_attrs_dups++;
}
- Curl_safefree(attributes);
+ free(attributes);
}
p = q;
@@ -965,7 +965,7 @@ static int _ldap_url_parse2 (const struct connectdata *conn, LDAPURLDesc *ludp)
}
quit:
- Curl_safefree(path);
+ free(path);
return rc;
}
diff --git a/lib/memdebug.h b/lib/memdebug.h
index bd565c8dc..b2b0e6966 100644
--- a/lib/memdebug.h
+++ b/lib/memdebug.h
@@ -8,7 +8,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -171,6 +171,6 @@ CURL_EXTERN int curl_fclose(FILE *file, int line, const char *source);
*/
#define Curl_safefree(ptr) \
- do {if((ptr)) {free((ptr)); (ptr) = NULL;}} WHILE_FALSE
+ do { free((ptr)); (ptr) = NULL;} WHILE_FALSE
#endif /* HEADER_CURL_MEMDEBUG_H */
diff --git a/lib/multi.c b/lib/multi.c
index 88e81c631..bf3a897ae 100644
--- a/lib/multi.c
+++ b/lib/multi.c
@@ -926,7 +926,7 @@ CURLMcode curl_multi_wait(CURLM *multi_handle,
else
i = 0;
- Curl_safefree(ufds);
+ free(ufds);
if(ret)
*ret = i;
return CURLM_OK;
diff --git a/lib/netrc.c b/lib/netrc.c
index 45a36e49a..dbe79d3dd 100644
--- a/lib/netrc.c
+++ b/lib/netrc.c
@@ -102,7 +102,7 @@ int Curl_parsenetrc(const char *host,
netrcfile = curl_maprintf("%s%s%s", home, DIR_CHAR, NETRC);
if(home_alloc)
- Curl_safefree(home);
+ free(home);
if(!netrcfile) {
return -1;
}
@@ -111,7 +111,7 @@ int Curl_parsenetrc(const char *host,
file = fopen(netrcfile, "r");
if(netrc_alloc)
- Curl_safefree(netrcfile);
+ free(netrcfile);
if(file) {
char *tok;
char *tok_buf;
diff --git a/lib/pipeline.c b/lib/pipeline.c
index 2645fdb48..50df4adb2 100644
--- a/lib/pipeline.c
+++ b/lib/pipeline.c
@@ -6,7 +6,7 @@
* \___|\___/|_| \_\_____|
*
* Copyright (C) 2013, Linus Nielsen Feltzing, <linus@haxx.se>
- * Copyright (C) 2013-2014, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 2013-2015, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -49,15 +49,13 @@ static void site_blacklist_llist_dtor(void *user, void *element)
(void)user;
Curl_safefree(entry->hostname);
- Curl_safefree(entry);
+ free(entry);
}
static void server_blacklist_llist_dtor(void *user, void *element)
{
- char *server_name = element;
(void)user;
-
- Curl_safefree(server_name);
+ free(element);
}
bool Curl_pipeline_penalized(struct SessionHandle *data,
diff --git a/lib/smb.c b/lib/smb.c
index e66427ba3..cb4d997a6 100644
--- a/lib/smb.c
+++ b/lib/smb.c
@@ -935,7 +935,7 @@ static CURLcode smb_parse_url_path(struct connectdata *conn)
/* Parse the path for the share */
req->share = strdup((*path == '/' || *path == '\\') ? path + 1 : path);
if(!req->share) {
- Curl_safefree(path);
+ free(path);
return CURLE_OUT_OF_MEMORY;
}
@@ -946,7 +946,7 @@ static CURLcode smb_parse_url_path(struct connectdata *conn)
/* The share must be present */
if(!slash) {
- Curl_safefree(path);
+ free(path);
return CURLE_URL_MALFORMAT;
}
@@ -960,7 +960,7 @@ static CURLcode smb_parse_url_path(struct connectdata *conn)
*slash = '\\';
}
- Curl_safefree(path);
+ free(path);
return CURLE_OK;
}
diff --git a/lib/smtp.c b/lib/smtp.c
index de2bce328..dada087a9 100644
--- a/lib/smtp.c
+++ b/lib/smtp.c
@@ -571,7 +571,7 @@ static CURLcode smtp_perform_mail(struct connectdata *conn)
auth = strdup("<>");
if(!auth) {
- Curl_safefree(from);
+ free(from);
return CURLE_OUT_OF_MEMORY;
}
@@ -582,8 +582,8 @@ static CURLcode smtp_perform_mail(struct connectdata *conn)
size = aprintf("%" CURL_FORMAT_CURL_OFF_T, data->state.infilesize);
if(!size) {
- Curl_safefree(from);
- Curl_safefree(auth);
+ free(from);
+ free(auth);
return CURLE_OUT_OF_MEMORY;
}
@@ -603,9 +603,9 @@ static CURLcode smtp_perform_mail(struct connectdata *conn)
result = Curl_pp_sendf(&conn->proto.smtpc.pp,
"MAIL FROM:%s SIZE=%s", from, size);
- Curl_safefree(from);
- Curl_safefree(auth);
- Curl_safefree(size);
+ free(from);
+ free(auth);
+ free(size);
if(!result)
state(conn, SMTP_MAIL);
@@ -1657,13 +1657,13 @@ CURLcode Curl_smtp_escape_eob(struct connectdata *conn, const ssize_t nread)
data->state.scratch = scratch;
/* Free the old scratch buffer */
- Curl_safefree(oldscratch);
+ free(oldscratch);
/* Set the new amount too */
data->req.upload_present = si;
}
else
- Curl_safefree(newscratch);
+ free(newscratch);
return CURLE_OK;
}
diff --git a/lib/socks_sspi.c b/lib/socks_sspi.c
index 1e623314e..4f3d66835 100644
--- a/lib/socks_sspi.c
+++ b/lib/socks_sspi.c
@@ -143,7 +143,7 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(int sockindex,
if(check_sspi_err(conn, status, "AcquireCredentialsHandle")) {
failf(data, "Failed to acquire credentials.");
- Curl_safefree(service_name);
+ free(service_name);
s_pSecFn->FreeCredentialsHandle(&cred_handle);
return CURLE_COULDNT_CONNECT;
}
@@ -182,7 +182,7 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(int sockindex,
}
if(check_sspi_err(conn, status, "InitializeSecurityContext")) {
- Curl_safefree(service_name);
+ free(service_name);
s_pSecFn->FreeCredentialsHandle(&cred_handle);
s_pSecFn->DeleteSecurityContext(&sspi_context);
if(sspi_recv_token.pvBuffer)
@@ -200,7 +200,7 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(int sockindex,
code = Curl_write_plain(conn, sock, (char *)socksreq, 4, &written);
if(code || (4 != written)) {
failf(data, "Failed to send SSPI authentication request.");
- Curl_safefree(service_name);
+ free(service_name);
if(sspi_send_token.pvBuffer)
s_pSecFn->FreeContextBuffer(sspi_send_token.pvBuffer);
if(sspi_recv_token.pvBuffer)
@@ -214,7 +214,7 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(int sockindex,
sspi_send_token.cbBuffer, &written);
if(code || (sspi_send_token.cbBuffer != (size_t)written)) {
failf(data, "Failed to send SSPI authentication token.");
- Curl_safefree(service_name);
+ free(service_name);
if(sspi_send_token.pvBuffer)
s_pSecFn->FreeContextBuffer(sspi_send_token.pvBuffer);
if(sspi_recv_token.pvBuffer)
@@ -254,7 +254,7 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(int sockindex,
result = Curl_blockread_all(conn, sock, (char *)socksreq, 4, &actualread);
if(result || (actualread != 4)) {
failf(data, "Failed to receive SSPI authentication response.");
- Curl_safefree(service_name);
+ free(service_name);
s_pSecFn->FreeCredentialsHandle(&cred_handle);
s_pSecFn->DeleteSecurityContext(&sspi_context);
return CURLE_COULDNT_CONNECT;
@@ -264,7 +264,7 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(int sockindex,
if(socksreq[1] == 255) { /* status / message type */
failf(data, "User was rejected by the SOCKS5 server (%u %u).",
(unsigned int)socksreq[0], (unsigned int)socksreq[1]);
- Curl_safefree(service_name);
+ free(service_name);
s_pSecFn->FreeCredentialsHandle(&cred_handle);
s_pSecFn->DeleteSecurityContext(&sspi_context);
return CURLE_COULDNT_CONNECT;
@@ -273,7 +273,7 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(int sockindex,
if(socksreq[1] != 1) { /* status / messgae type */
failf(data, "Invalid SSPI authentication response type (%u %u).",
(unsigned int)socksreq[0], (unsigned int)socksreq[1]);
- Curl_safefree(service_name);
+ free(service_name);
s_pSecFn->FreeCredentialsHandle(&cred_handle);
s_pSecFn->DeleteSecurityContext(&sspi_context);
return CURLE_COULDNT_CONNECT;
@@ -286,7 +286,7 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(int sockindex,
sspi_recv_token.pvBuffer = malloc(us_length);
if(!sspi_recv_token.pvBuffer) {
- Curl_safefree(service_name);
+ free(service_name);
s_pSecFn->FreeCredentialsHandle(&cred_handle);
s_pSecFn->DeleteSecurityContext(&sspi_context);
return CURLE_OUT_OF_MEMORY;
@@ -296,7 +296,7 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(int sockindex,
if(result || (actualread != us_length)) {
failf(data, "Failed to receive SSPI authentication token.");
- Curl_safefree(service_name);
+ free(service_name);
if(sspi_recv_token.pvBuffer)
s_pSecFn->FreeContextBuffer(sspi_recv_token.pvBuffer);
s_pSecFn->FreeCredentialsHandle(&cred_handle);
@@ -307,7 +307,7 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(int sockindex,
context_handle = &sspi_context;
}
- Curl_safefree(service_name);
+ free(service_name);
/* Everything is good so far, user was authenticated! */
status = s_pSecFn->QueryCredentialsAttributes(&cred_handle,
diff --git a/lib/ssh.c b/lib/ssh.c
index 5dddc3f15..15258cd42 100644
--- a/lib/ssh.c
+++ b/lib/ssh.c
@@ -855,7 +855,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
}
if(out_of_memory || sshc->rsa == NULL) {
- Curl_safefree(home);
+ free(home);
Curl_safefree(sshc->rsa);
Curl_safefree(sshc->rsa_pub);
state(conn, SSH_SESSION_FREE);
@@ -867,7 +867,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
if(!sshc->passphrase)
sshc->passphrase = "";
- Curl_safefree(home);
+ free(home);
infof(data, "Using SSH public key file '%s'\n", sshc->rsa_pub);
infof(data, "Using SSH private key file '%s'\n", sshc->rsa);
@@ -1918,7 +1918,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
}
result = Curl_client_write(conn, CLIENTWRITE_BODY,
tmpLine, sshc->readdir_len+1);
- Curl_safefree(tmpLine);
+ free(tmpLine);
if(result) {
state(conn, SSH_STOP);
@@ -3267,8 +3267,8 @@ get_pathname(const char **cpp, char **path)
return CURLE_OK;
fail:
- Curl_safefree(*path);
- return CURLE_QUOTE_ERROR;
+ Curl_safefree(*path);
+ return CURLE_QUOTE_ERROR;
}
diff --git a/lib/tftp.c b/lib/tftp.c
index 161c85c67..61dc70e36 100644
--- a/lib/tftp.c
+++ b/lib/tftp.c
@@ -531,7 +531,7 @@ static CURLcode tftp_send_first(tftp_state_data_t *state, tftp_event_t event)
if(senddata != (ssize_t)sbytes) {
failf(data, "%s", Curl_strerror(state->conn, SOCKERRNO));
}
- Curl_safefree(filename);
+ free(filename);
break;
case TFTP_EVENT_OACK:
diff --git a/lib/url.c b/lib/url.c
index eb98e361b..15f735519 100644
--- a/lib/url.c
+++ b/lib/url.c
@@ -1235,7 +1235,7 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option,
argptr = strdup(argptr);
if(!argptr || !data->cookies) {
result = CURLE_OUT_OF_MEMORY;
- Curl_safefree(argptr);
+ free(argptr);
}
else {
Curl_share_lock(data, CURL_LOCK_DATA_COOKIE, CURL_LOCK_ACCESS_SINGLE);
@@ -3780,9 +3780,9 @@ static struct connectdata *allocate_conn(struct SessionHandle *data)
conn->send_pipe = NULL;
conn->recv_pipe = NULL;
- Curl_safefree(conn->master_buffer);
- Curl_safefree(conn->localdev);
- Curl_safefree(conn);
+ free(conn->master_buffer);
+ free(conn->localdev);
+ free(conn);
return NULL;
}
@@ -4508,8 +4508,8 @@ static CURLcode parse_proxy(struct SessionHandle *data,
}
}
- Curl_safefree(proxyuser);
- Curl_safefree(proxypasswd);
+ free(proxyuser);
+ free(proxypasswd);
if(result)
return result;
@@ -4721,9 +4721,9 @@ static CURLcode parse_url_login(struct SessionHandle *data,
out:
- Curl_safefree(userp);
- Curl_safefree(passwdp);
- Curl_safefree(optionsp);
+ free(userp);
+ free(passwdp);
+ free(optionsp);
return result;
}
@@ -4811,7 +4811,7 @@ static CURLcode parse_login_details(const char *login, const size_t len,
if(!result && passwdp && plen) {
pbuf = malloc(plen + 1);
if(!pbuf) {
- Curl_safefree(ubuf);
+ free(ubuf);
result = CURLE_OUT_OF_MEMORY;
}
}
@@ -4820,8 +4820,8 @@ static CURLcode parse_login_details(const char *login, const size_t len,
if(!result && optionsp && olen) {
obuf = malloc(olen + 1);
if(!obuf) {
- Curl_safefree(pbuf);
- Curl_safefree(ubuf);
+ free(pbuf);
+ free(ubuf);
result = CURLE_OUT_OF_MEMORY;
}
}
@@ -5459,7 +5459,8 @@ static CURLcode create_conn(struct SessionHandle *data,
if(proxy) {
result = parse_proxy(data, conn, proxy);
- Curl_safefree(proxy); /* parse_proxy copies the proxy string */
+ free(proxy); /* parse_proxy copies the proxy string */
+ proxy = NULL;
if(result)
goto out;
@@ -5759,10 +5760,10 @@ static CURLcode create_conn(struct SessionHandle *data,
out:
- Curl_safefree(options);
- Curl_safefree(passwd);
- Curl_safefree(user);
- Curl_safefree(proxy);
+ free(options);
+ free(passwd);
+ free(user);
+ free(proxy);
return result;
}
diff --git a/tests/data/test96 b/tests/data/test96
index 3d9a933a0..27044bc99 100644
--- a/tests/data/test96
+++ b/tests/data/test96
@@ -37,7 +37,7 @@ MEM tool_cfgable.c
MEM tool_cfgable.c
</file>
<stripfile>
-$_ = '' if (($_ !~ /tool_paramhlp/) && ($_ !~ /tool_cfgable/))
+$_ = '' if ((($_ !~ /tool_paramhlp/) && ($_ !~ /tool_cfgable/)) || ($_ =~ /free\(\(nil\)\)/))
s/:\d+.*//
s:^(MEM )(.*/)(.*):$1$3:
</stripfile>