From: Viktor Szakats Date: Sun, 29 Mar 2026 23:54:10 +0000 (+0200) Subject: tidy-up: rename `Curl_safefree()`/`tool_safefree()` to `curlx_safefree()` X-Git-Tag: rc-8_20_0-1~17 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=0df6c01db398f5e25d00a062aae56f2a89d8ff55;p=thirdparty%2Fcurl.git tidy-up: rename `Curl_safefree()`/`tool_safefree()` to `curlx_safefree()` To sync names for the same macro logic between lib and src, and to move it to the curlx namespace, to match `curlx_free()` that it's calling. Closes #21151 --- diff --git a/lib/asyn-base.c b/lib/asyn-base.c index 027afa2abf..9e400a914b 100644 --- a/lib/asyn-base.c +++ b/lib/asyn-base.c @@ -238,7 +238,7 @@ void Curl_async_destroy(struct Curl_easy *data, #ifndef CURL_DISABLE_DOH Curl_doh_cleanup(data, async); #endif - Curl_safefree(async); + curlx_safefree(async); } } diff --git a/lib/cf-h1-proxy.c b/lib/cf-h1-proxy.c index 9e94e97e63..4c9e9db8ea 100644 --- a/lib/cf-h1-proxy.c +++ b/lib/cf-h1-proxy.c @@ -172,7 +172,7 @@ static void h1_tunnel_go_state(struct Curl_cfilter *cf, /* If a proxy-authorization header was used for the proxy, then we should make sure that it is not accidentally used for the document request after we have connected. Let's thus free and clear it here. */ - Curl_safefree(data->state.aptr.proxyuserpwd); + curlx_safefree(data->state.aptr.proxyuserpwd); break; } } @@ -208,7 +208,7 @@ static CURLcode start_CONNECT(struct Curl_cfilter *cf, /* This only happens if we have looped here due to authentication reasons, and we do not really use the newly cloned URL here then. Free it. */ - Curl_safefree(data->req.newurl); + curlx_safefree(data->req.newurl); result = Curl_http_proxy_create_CONNECT(&req, cf, data, 1); if(result) @@ -643,7 +643,7 @@ static CURLcode H1_CONNECT(struct Curl_cfilter *cf, DEBUGASSERT(ts->tunnel_state == H1_TUNNEL_RESPONSE); if(data->info.httpproxycode / 100 != 2) { /* a non-2xx response and we have no next URL to try. */ - Curl_safefree(data->req.newurl); + curlx_safefree(data->req.newurl); h1_tunnel_go_state(cf, ts, H1_TUNNEL_FAILED, data); failf(data, "CONNECT tunnel failed, response %d", data->req.httpcode); return CURLE_COULDNT_CONNECT; @@ -690,7 +690,7 @@ static CURLcode cf_h1_proxy_connect(struct Curl_cfilter *cf, result = H1_CONNECT(cf, data, ts); if(result) goto out; - Curl_safefree(data->state.aptr.proxyuserpwd); + curlx_safefree(data->state.aptr.proxyuserpwd); out: *done = (result == CURLE_OK) && tunnel_is_established(cf->ctx); diff --git a/lib/cf-h2-proxy.c b/lib/cf-h2-proxy.c index f836b05693..99c39f6f98 100644 --- a/lib/cf-h2-proxy.c +++ b/lib/cf-h2-proxy.c @@ -105,7 +105,7 @@ static void tunnel_stream_clear(struct tunnel_stream *ts) Curl_http_resp_free(ts->resp); Curl_bufq_free(&ts->recvbuf); Curl_bufq_free(&ts->sendbuf); - Curl_safefree(ts->authority); + curlx_safefree(ts->authority); memset(ts, 0, sizeof(*ts)); ts->state = H2_TUNNEL_INIT; } @@ -158,7 +158,7 @@ static void h2_tunnel_go_state(struct Curl_cfilter *cf, /* If a proxy-authorization header was used for the proxy, then we should make sure that it is not accidentally used for the document request after we have connected. Let's thus free and clear it here. */ - Curl_safefree(data->state.aptr.proxyuserpwd); + curlx_safefree(data->state.aptr.proxyuserpwd); break; } } @@ -804,7 +804,7 @@ static CURLcode inspect_response(struct Curl_cfilter *cf, return result; if(data->req.newurl) { /* Indicator that we should try again */ - Curl_safefree(data->req.newurl); + curlx_safefree(data->req.newurl); h2_tunnel_go_state(cf, ts, H2_TUNNEL_INIT, data); return CURLE_OK; } diff --git a/lib/cf-ip-happy.c b/lib/cf-ip-happy.c index 4df7cf4948..0eb35d467a 100644 --- a/lib/cf-ip-happy.c +++ b/lib/cf-ip-happy.c @@ -967,7 +967,7 @@ static CURLcode cf_ip_happy_create(struct Curl_cfilter **pcf, out: if(result) { - Curl_safefree(*pcf); + curlx_safefree(*pcf); cf_ip_happy_ctx_destroy(ctx); } return result; diff --git a/lib/cf-socket.c b/lib/cf-socket.c index 79a1a1e006..6a1057ea9b 100644 --- a/lib/cf-socket.c +++ b/lib/cf-socket.c @@ -1735,8 +1735,8 @@ CURLcode Curl_cf_tcp_create(struct Curl_cfilter **pcf, out: *pcf = (!result) ? cf : NULL; if(result) { - Curl_safefree(cf); - Curl_safefree(ctx); + curlx_safefree(cf); + curlx_safefree(ctx); } return result; @@ -1896,8 +1896,8 @@ CURLcode Curl_cf_udp_create(struct Curl_cfilter **pcf, out: *pcf = (!result) ? cf : NULL; if(result) { - Curl_safefree(cf); - Curl_safefree(ctx); + curlx_safefree(cf); + curlx_safefree(ctx); } return result; @@ -1950,8 +1950,8 @@ CURLcode Curl_cf_unix_create(struct Curl_cfilter **pcf, out: *pcf = (!result) ? cf : NULL; if(result) { - Curl_safefree(cf); - Curl_safefree(ctx); + curlx_safefree(cf); + curlx_safefree(ctx); } return result; @@ -2187,8 +2187,8 @@ CURLcode Curl_conn_tcp_listen_set(struct Curl_easy *data, out: if(result) { - Curl_safefree(cf); - Curl_safefree(ctx); + curlx_safefree(cf); + curlx_safefree(ctx); } return result; } diff --git a/lib/connect.c b/lib/connect.c index 111d728252..85b97c37a0 100644 --- a/lib/connect.c +++ b/lib/connect.c @@ -462,7 +462,7 @@ static void cf_setup_destroy(struct Curl_cfilter *cf, struct Curl_easy *data) struct cf_setup_ctx *ctx = cf->ctx; CURL_TRC_CF(data, cf, "destroy"); - Curl_safefree(ctx); + curlx_safefree(ctx); } struct Curl_cftype Curl_cft_setup = { diff --git a/lib/curl_setup.h b/lib/curl_setup.h index 65dc236688..3042bba346 100644 --- a/lib/curl_setup.h +++ b/lib/curl_setup.h @@ -1322,14 +1322,14 @@ extern curl_strdup_callback Curl_cstrdup; extern curl_calloc_callback Curl_ccalloc; /* - * Curl_safefree defined as a macro to allow MemoryTracking feature - * to log free() calls at same location where Curl_safefree is used. + * curlx_safefree() defined as a macro to allow MemoryTracking feature + * to log free() calls at same location where curlx_safefree() is used. * This macro also assigns NULL to given pointer when free'd. */ -#define Curl_safefree(ptr) \ - do { \ - curlx_free(ptr); \ - (ptr) = NULL; \ +#define curlx_safefree(ptr) \ + do { \ + curlx_free(ptr); \ + (ptr) = NULL; \ } while(0) #include /* for CURL_EXTERN, curl_socket_t, mprintf.h */ diff --git a/lib/curl_sspi.c b/lib/curl_sspi.c index 1d4cf925d6..3ea17621b1 100644 --- a/lib/curl_sspi.c +++ b/lib/curl_sspi.c @@ -198,9 +198,9 @@ CURLcode Curl_create_sspi_identity(const char *userp, const char *passwdp, void Curl_sspi_free_identity(SEC_WINNT_AUTH_IDENTITY *identity) { if(identity) { - Curl_safefree(identity->User); - Curl_safefree(identity->Password); - Curl_safefree(identity->Domain); + curlx_safefree(identity->User); + curlx_safefree(identity->Password); + curlx_safefree(identity->Domain); } } diff --git a/lib/curlx/dynbuf.c b/lib/curlx/dynbuf.c index a77363ac59..1e5ea5177d 100644 --- a/lib/curlx/dynbuf.c +++ b/lib/curlx/dynbuf.c @@ -57,7 +57,7 @@ void curlx_dyn_free(struct dynbuf *s) { DEBUGASSERT(s); DEBUGASSERT(s->init == DYNINIT); - Curl_safefree(s->bufr); + curlx_safefree(s->bufr); s->leng = s->allc = 0; } diff --git a/lib/doh.c b/lib/doh.c index 53d080b3bb..cac5a9f0c9 100644 --- a/lib/doh.c +++ b/lib/doh.c @@ -1057,7 +1057,7 @@ UNITTEST void de_cleanup(struct dohentry *d) } #ifdef USE_HTTPSRR for(i = 0; i < d->numhttps_rrs; i++) - Curl_safefree(d->https_rrs[i].val); + curlx_safefree(d->https_rrs[i].val); #endif } @@ -1176,7 +1176,7 @@ UNITTEST CURLcode doh_resp_decode_httpsrr(struct Curl_easy *data, return CURLE_OK; err: Curl_httpsrr_cleanup(lhrr); - Curl_safefree(lhrr); + curlx_safefree(lhrr); return result; } @@ -1360,7 +1360,7 @@ void Curl_doh_cleanup(struct Curl_easy *data, for(i = 0; i < DOH_SLOT_COUNT; ++i) { curlx_dyn_free(&dohp->probe_resp[i].body); } - Curl_safefree(async->doh); + curlx_safefree(async->doh); } } diff --git a/lib/dynhds.c b/lib/dynhds.c index fb111c5f1b..2930e45b52 100644 --- a/lib/dynhds.c +++ b/lib/dynhds.c @@ -76,7 +76,7 @@ void Curl_dynhds_free(struct dynhds *dynhds) entry_free(dynhds->hds[i]); } } - Curl_safefree(dynhds->hds); + curlx_safefree(dynhds->hds); dynhds->hds_len = dynhds->hds_allc = dynhds->strs_len = 0; } @@ -158,7 +158,7 @@ CURLcode Curl_dynhds_add(struct dynhds *dynhds, if(dynhds->hds) { memcpy(nhds, dynhds->hds, dynhds->hds_len * sizeof(struct dynhds_entry *)); - Curl_safefree(dynhds->hds); + curlx_safefree(dynhds->hds); } dynhds->hds = nhds; dynhds->hds_allc = nallc; diff --git a/lib/escape.c b/lib/escape.c index be44e97156..0427faed1f 100644 --- a/lib/escape.c +++ b/lib/escape.c @@ -138,7 +138,7 @@ CURLcode Curl_urldecode(const char *string, size_t length, if(((ctrl == REJECT_CTRL) && (in < 0x20)) || ((ctrl == REJECT_ZERO) && (in == 0))) { - Curl_safefree(*ostring); + curlx_safefree(*ostring); return CURLE_URL_MALFORMAT; } @@ -177,7 +177,7 @@ char *curl_easy_unescape(CURL *data, const char *string, int length, int *olen) *olen = curlx_uztosi(outputlen); else /* too large to return in an int, fail! */ - Curl_safefree(str); + curlx_safefree(str); } } return str; diff --git a/lib/file.c b/lib/file.c index 4441f09e80..fff8feeb92 100644 --- a/lib/file.c +++ b/lib/file.c @@ -84,7 +84,7 @@ struct FILEPROTO { static void file_cleanup(struct FILEPROTO *file) { - Curl_safefree(file->freepath); + curlx_safefree(file->freepath); file->path = NULL; if(file->fd != -1) { curlx_close(file->fd); @@ -193,7 +193,7 @@ static CURLcode file_connect(struct Curl_easy *data, bool *done) if(actual_path[i] == '/') actual_path[i] = '\\'; else if(!actual_path[i]) { /* binary zero */ - Curl_safefree(real_path); + curlx_safefree(real_path); return CURLE_URL_MALFORMAT; } @@ -202,7 +202,7 @@ static CURLcode file_connect(struct Curl_easy *data, bool *done) #else if(memchr(real_path, 0, real_path_len)) { /* binary zeroes indicate foul play */ - Curl_safefree(real_path); + curlx_safefree(real_path); return CURLE_URL_MALFORMAT; } diff --git a/lib/ftp.c b/lib/ftp.c index 2f19d8af78..980efc3b2b 100644 --- a/lib/ftp.c +++ b/lib/ftp.c @@ -175,9 +175,9 @@ static CURLcode getftpresponse(struct Curl_easy *data, size_t *nreadp, static void freedirs(struct ftp_conn *ftpc) { - Curl_safefree(ftpc->dirs); + curlx_safefree(ftpc->dirs); ftpc->dirdepth = 0; - Curl_safefree(ftpc->rawpath); + curlx_safefree(ftpc->rawpath); ftpc->file = NULL; } @@ -4026,7 +4026,7 @@ fail: Curl_ftp_parselist_data_free(&ftpwc->parser); curlx_free(ftpwc); } - Curl_safefree(wildcard->pattern); + curlx_safefree(wildcard->pattern); wildcard->dtor = ZERO_NULL; wildcard->ftpwc = NULL; return result; @@ -4361,7 +4361,7 @@ static void ftp_easy_dtor(void *key, size_t klen, void *entry) struct FTP *ftp = entry; (void)key; (void)klen; - Curl_safefree(ftp->pathalloc); + curlx_safefree(ftp->pathalloc); curlx_free(ftp); } @@ -4371,11 +4371,11 @@ static void ftp_conn_dtor(void *key, size_t klen, void *entry) (void)key; (void)klen; freedirs(ftpc); - Curl_safefree(ftpc->account); - Curl_safefree(ftpc->alternative_to_user); - Curl_safefree(ftpc->entrypath); - Curl_safefree(ftpc->prevpath); - Curl_safefree(ftpc->server_os); + curlx_safefree(ftpc->account); + curlx_safefree(ftpc->alternative_to_user); + curlx_safefree(ftpc->entrypath); + curlx_safefree(ftpc->prevpath); + curlx_safefree(ftpc->server_os); Curl_pp_disconnect(&ftpc->pp); curlx_free(ftpc); } @@ -4438,7 +4438,7 @@ static CURLcode ftp_setup_connection(struct Curl_easy *data, ftpc->alternative_to_user = curlx_strdup(data->set.str[STRING_FTP_ALTERNATIVE_TO_USER]); if(!ftpc->alternative_to_user) { - Curl_safefree(ftpc->account); + curlx_safefree(ftpc->account); Curl_conn_meta_remove(conn, CURL_META_FTP_CONN); return CURLE_OUT_OF_MEMORY; } diff --git a/lib/hash.c b/lib/hash.c index 8095ca2e45..67879d8b57 100644 --- a/lib/hash.c +++ b/lib/hash.c @@ -265,7 +265,7 @@ void Curl_hash_destroy(struct Curl_hash *h) DEBUGASSERT(h->init == HASHINIT); if(h->table) { Curl_hash_clean(h); - Curl_safefree(h->table); + curlx_safefree(h->table); } DEBUGASSERT(h->size == 0); h->slots = 0; diff --git a/lib/http.c b/lib/http.c index 0f53eaa9a0..a35845cf2d 100644 --- a/lib/http.c +++ b/lib/http.c @@ -1254,8 +1254,8 @@ CURLcode Curl_http_follow(struct Curl_easy *data, const char *newurl, curlx_free(scheme); } if(clear) { - Curl_safefree(data->state.aptr.user); - Curl_safefree(data->state.aptr.passwd); + curlx_safefree(data->state.aptr.user); + curlx_safefree(data->state.aptr.passwd); } } } @@ -2020,7 +2020,7 @@ static CURLcode http_set_aptr_host(struct Curl_easy *data) data->state.first_remote_port = conn->remote_port; data->state.first_remote_protocol = conn->scheme->protocol; } - Curl_safefree(aptr->host); + curlx_safefree(aptr->host); ptr = Curl_checkheaders(data, STRCONST("Host")); if(ptr && (!data->state.this_is_a_follow || @@ -2223,7 +2223,7 @@ static CURLcode set_post_reader(struct Curl_easy *data, Curl_HttpReq httpreq) result = Curl_getformdata(data, data->state.formp, data->set.httppost, data->state.fread_func); if(result) { - Curl_safefree(data->state.formp); + curlx_safefree(data->state.formp); return result; } data->state.mimepost = data->state.formp; @@ -2937,7 +2937,7 @@ static CURLcode http_add_hd(struct Curl_easy *data, break; case H1_HD_ACCEPT_ENCODING: - Curl_safefree(data->state.aptr.accept_encoding); + curlx_safefree(data->state.aptr.accept_encoding); if(!Curl_checkheaders(data, STRCONST("Accept-Encoding")) && data->set.str[STRING_ENCODING]) result = curlx_dyn_addf(req, "Accept-Encoding: %s\r\n", @@ -2945,7 +2945,7 @@ static CURLcode http_add_hd(struct Curl_easy *data, break; case H1_HD_REFERER: - Curl_safefree(data->state.aptr.ref); + curlx_safefree(data->state.aptr.ref); if(Curl_bufref_ptr(&data->state.referer) && !Curl_checkheaders(data, STRCONST("Referer"))) result = curlx_dyn_addf(req, "Referer: %s\r\n", @@ -3119,9 +3119,9 @@ out: /* clear userpwd and proxyuserpwd to avoid reusing old credentials * from reused connections */ - Curl_safefree(data->state.aptr.userpwd); + curlx_safefree(data->state.aptr.userpwd); #ifndef CURL_DISABLE_PROXY - Curl_safefree(data->state.aptr.proxyuserpwd); + curlx_safefree(data->state.aptr.proxyuserpwd); #endif curlx_dyn_free(&req); return result; diff --git a/lib/http2.c b/lib/http2.c index 0757ab36de..c3f2c1be34 100644 --- a/lib/http2.c +++ b/lib/http2.c @@ -154,7 +154,7 @@ static void free_push_headers(struct h2_stream_ctx *stream) size_t i; for(i = 0; i < stream->push_headers_used; i++) curlx_free(stream->push_headers[i]); - Curl_safefree(stream->push_headers); + curlx_safefree(stream->push_headers); stream->push_headers_used = 0; } @@ -2202,7 +2202,7 @@ static CURLcode h2_submit(struct h2_stream_ctx **pstream, out: CURL_TRC_CF(data, cf, "[%d] submit -> %d, %zu", stream ? stream->id : -1, result, *pnwritten); - Curl_safefree(nva); + curlx_safefree(nva); *pstream = stream; Curl_dynhds_free(&h2_headers); return result; diff --git a/lib/http_digest.c b/lib/http_digest.c index b293578957..5d77fd26a2 100644 --- a/lib/http_digest.c +++ b/lib/http_digest.c @@ -105,7 +105,7 @@ CURLcode Curl_output_digest(struct Curl_easy *data, authp = &data->state.authhost; } - Curl_safefree(*allocuserpwd); + curlx_safefree(*allocuserpwd); /* not set means empty */ if(!userp) diff --git a/lib/http_ntlm.c b/lib/http_ntlm.c index c4dbdf9ca5..abe945886c 100644 --- a/lib/http_ntlm.c +++ b/lib/http_ntlm.c @@ -242,7 +242,7 @@ CURLcode Curl_output_ntlm(struct Curl_easy *data, bool proxy) data->info.proxyauthpicked = CURLAUTH_NTLM; else data->info.httpauthpicked = CURLAUTH_NTLM; - Curl_safefree(*allocuserpwd); + curlx_safefree(*allocuserpwd); authp->done = TRUE; break; } diff --git a/lib/httpsrr.c b/lib/httpsrr.c index b8132ff2c9..c737d2ffd3 100644 --- a/lib/httpsrr.c +++ b/lib/httpsrr.c @@ -205,11 +205,11 @@ Curl_httpsrr_dup_move(struct Curl_https_rrinfo *rrinfo) void Curl_httpsrr_cleanup(struct Curl_https_rrinfo *rrinfo) { - Curl_safefree(rrinfo->target); - Curl_safefree(rrinfo->echconfiglist); - Curl_safefree(rrinfo->ipv4hints); - Curl_safefree(rrinfo->ipv6hints); - Curl_safefree(rrinfo->rrname); + curlx_safefree(rrinfo->target); + curlx_safefree(rrinfo->echconfiglist); + curlx_safefree(rrinfo->ipv4hints); + curlx_safefree(rrinfo->ipv6hints); + curlx_safefree(rrinfo->rrname); rrinfo->complete = FALSE; } @@ -261,7 +261,7 @@ CURLcode Curl_httpsrr_from_ares(const ares_dns_record_t *dnsrec, } out: hinfo->complete = !result; - Curl_safefree(hinfo->rrname); + curlx_safefree(hinfo->rrname); return result; } diff --git a/lib/idn.c b/lib/idn.c index 2db4f6d79e..2905e39162 100644 --- a/lib/idn.c +++ b/lib/idn.c @@ -348,7 +348,7 @@ CURLcode Curl_idn_encode(const char *puny, char **output) */ void Curl_free_idnconverted_hostname(struct hostname *host) { - Curl_safefree(host->encalloc); + curlx_safefree(host->encalloc); } #endif /* USE_IDN */ diff --git a/lib/imap.c b/lib/imap.c index 8ac9eb6ec5..ccfbeb72c4 100644 --- a/lib/imap.c +++ b/lib/imap.c @@ -775,7 +775,7 @@ static CURLcode imap_perform_select(struct Curl_easy *data, char *mailbox; /* Invalidate old information as we are switching mailboxes */ - Curl_safefree(imapc->mailbox); + curlx_safefree(imapc->mailbox); imapc->mb_uidvalidity_set = FALSE; /* Check we have a mailbox */ @@ -1696,14 +1696,14 @@ static CURLcode imap_pollset(struct Curl_easy *data, static void imap_easy_reset(struct IMAP *imap) { - Curl_safefree(imap->mailbox); - Curl_safefree(imap->uid); - Curl_safefree(imap->mindex); - Curl_safefree(imap->section); - Curl_safefree(imap->partial); - Curl_safefree(imap->query); - Curl_safefree(imap->custom); - Curl_safefree(imap->custom_params); + curlx_safefree(imap->mailbox); + curlx_safefree(imap->uid); + curlx_safefree(imap->mindex); + curlx_safefree(imap->section); + curlx_safefree(imap->partial); + curlx_safefree(imap->query); + curlx_safefree(imap->custom); + curlx_safefree(imap->custom_params); imap->uidvalidity_set = FALSE; /* Clear the transfer mode for the next request */ imap->transfer = PPTRANSFER_BODY; @@ -2250,7 +2250,7 @@ static void imap_conn_dtor(void *key, size_t klen, void *entry) (void)klen; Curl_pp_disconnect(&imapc->pp); curlx_dyn_free(&imapc->dyn); - Curl_safefree(imapc->mailbox); + curlx_safefree(imapc->mailbox); curlx_free(imapc); } diff --git a/lib/mime.c b/lib/mime.c index 37ea514e4f..f4be1d6332 100644 --- a/lib/mime.c +++ b/lib/mime.c @@ -599,7 +599,7 @@ static int mime_mem_seek(void *instream, curl_off_t offset, int whence) static void mime_mem_free(void *ptr) { - Curl_safefree(((curl_mimepart *)ptr)->data); + curlx_safefree(((curl_mimepart *)ptr)->data); } /* Named file callbacks. */ @@ -650,7 +650,7 @@ static void mime_file_free(void *ptr) curlx_fclose(part->fp); part->fp = NULL; } - Curl_safefree(part->data); + curlx_safefree(part->data); } /* Subparts callbacks. */ @@ -1071,9 +1071,9 @@ void Curl_mime_cleanpart(curl_mimepart *part) curl_slist_free_all(part->curlheaders); if(part->flags & MIME_USERHEADERS_OWNER) curl_slist_free_all(part->userheaders); - Curl_safefree(part->mimetype); - Curl_safefree(part->name); - Curl_safefree(part->filename); + curlx_safefree(part->mimetype); + curlx_safefree(part->name); + curlx_safefree(part->filename); Curl_mime_initpart(part); } } @@ -1241,7 +1241,7 @@ CURLcode curl_mime_name(curl_mimepart *part, const char *name) if(!part) return CURLE_BAD_FUNCTION_ARGUMENT; - Curl_safefree(part->name); + curlx_safefree(part->name); if(name) { part->name = curlx_strdup(name); @@ -1258,7 +1258,7 @@ CURLcode curl_mime_filename(curl_mimepart *part, const char *filename) if(!part) return CURLE_BAD_FUNCTION_ARGUMENT; - Curl_safefree(part->filename); + curlx_safefree(part->filename); if(filename) { part->filename = curlx_strdup(filename); @@ -1350,7 +1350,7 @@ CURLcode curl_mime_type(curl_mimepart *part, const char *mimetype) if(!part) return CURLE_BAD_FUNCTION_ARGUMENT; - Curl_safefree(part->mimetype); + curlx_safefree(part->mimetype); if(mimetype) { part->mimetype = curlx_strdup(mimetype); @@ -1759,8 +1759,8 @@ CURLcode Curl_mime_prepare_headers(struct Curl_easy *data, filename ? "; filename=\"" : "", filename ? filename : "", filename ? "\"" : ""); - Curl_safefree(name); - Curl_safefree(filename); + curlx_safefree(name); + curlx_safefree(filename); if(ret) return ret; } diff --git a/lib/mqtt.c b/lib/mqtt.c index 8e57eabc72..84fd272e21 100644 --- a/lib/mqtt.c +++ b/lib/mqtt.c @@ -351,8 +351,8 @@ static CURLcode mqtt_connect(struct Curl_easy *data) end: if(packet) curlx_free(packet); - Curl_safefree(data->state.aptr.user); - Curl_safefree(data->state.aptr.passwd); + curlx_safefree(data->state.aptr.user); + curlx_safefree(data->state.aptr.passwd); return result; } diff --git a/lib/multi.c b/lib/multi.c index d1d1ad4abe..9a45548c75 100644 --- a/lib/multi.c +++ b/lib/multi.c @@ -705,8 +705,8 @@ static CURLcode multi_done(struct Curl_easy *data, Curl_resolv_shutdown_all(data); /* Cleanup possible redirect junk */ - Curl_safefree(data->req.newurl); - Curl_safefree(data->req.location); + curlx_safefree(data->req.newurl); + curlx_safefree(data->req.location); switch(status) { case CURLE_ABORTED_BY_CALLBACK: @@ -4013,13 +4013,13 @@ void Curl_multi_xfer_sockbuf_release(struct Curl_easy *data, char *buf) static void multi_xfer_bufs_free(struct Curl_multi *multi) { DEBUGASSERT(multi); - Curl_safefree(multi->xfer_buf); + curlx_safefree(multi->xfer_buf); multi->xfer_buf_len = 0; multi->xfer_buf_borrowed = FALSE; - Curl_safefree(multi->xfer_ulbuf); + curlx_safefree(multi->xfer_ulbuf); multi->xfer_ulbuf_len = 0; multi->xfer_ulbuf_borrowed = FALSE; - Curl_safefree(multi->xfer_sockbuf); + curlx_safefree(multi->xfer_sockbuf); multi->xfer_sockbuf_len = 0; multi->xfer_sockbuf_borrowed = FALSE; } diff --git a/lib/netrc.c b/lib/netrc.c index 2a9c7f5cc5..72d8feee7d 100644 --- a/lib/netrc.c +++ b/lib/netrc.c @@ -249,9 +249,9 @@ static void netrc_new_machine(struct netrc_state *ns) ns->keyword = NONE; ns->found = 0; ns->our_login = FALSE; - Curl_safefree(ns->password); + curlx_safefree(ns->password); if(!ns->specific_login) - Curl_safefree(ns->login); + curlx_safefree(ns->login); } /* diff --git a/lib/pop3.c b/lib/pop3.c index 19997948df..317c04bbe3 100644 --- a/lib/pop3.c +++ b/lib/pop3.c @@ -1479,8 +1479,8 @@ static CURLcode pop3_done(struct Curl_easy *data, CURLcode status, } /* Cleanup our per-request based variables */ - Curl_safefree(pop3->id); - Curl_safefree(pop3->custom); + curlx_safefree(pop3->id); + curlx_safefree(pop3->custom); /* Clear the transfer mode for the next request */ pop3->transfer = PPTRANSFER_BODY; @@ -1627,7 +1627,7 @@ static CURLcode pop3_disconnect(struct Curl_easy *data, Curl_pp_disconnect(&pop3c->pp); /* Cleanup our connection based variables */ - Curl_safefree(pop3c->apoptimestamp); + curlx_safefree(pop3c->apoptimestamp); return CURLE_OK; } @@ -1655,8 +1655,8 @@ static void pop3_easy_dtor(void *key, size_t klen, void *entry) (void)klen; DEBUGASSERT(pop3); /* Cleanup our per-request based variables */ - Curl_safefree(pop3->id); - Curl_safefree(pop3->custom); + curlx_safefree(pop3->id); + curlx_safefree(pop3->custom); curlx_free(pop3); } @@ -1667,7 +1667,7 @@ static void pop3_conn_dtor(void *key, size_t klen, void *entry) (void)klen; DEBUGASSERT(pop3c); Curl_pp_disconnect(&pop3c->pp); - Curl_safefree(pop3c->apoptimestamp); + curlx_safefree(pop3c->apoptimestamp); curlx_free(pop3c); } diff --git a/lib/request.c b/lib/request.c index 96aa9bf327..d45743c1a3 100644 --- a/lib/request.c +++ b/lib/request.c @@ -109,7 +109,7 @@ void Curl_req_hard_reset(struct SingleRequest *req, struct Curl_easy *data) { struct curltime t0 = { 0, 0 }; - Curl_safefree(req->newurl); + curlx_safefree(req->newurl); Curl_client_reset(data); if(req->sendbuf_init) Curl_bufq_reset(&req->sendbuf); @@ -162,7 +162,7 @@ void Curl_req_hard_reset(struct SingleRequest *req, struct Curl_easy *data) void Curl_req_free(struct SingleRequest *req, struct Curl_easy *data) { - Curl_safefree(req->newurl); + curlx_safefree(req->newurl); if(req->sendbuf_init) Curl_bufq_free(&req->sendbuf); Curl_client_cleanup(data); diff --git a/lib/rtsp.c b/lib/rtsp.c index 078f5993c6..4c9dd57c08 100644 --- a/lib/rtsp.c +++ b/lib/rtsp.c @@ -439,7 +439,7 @@ static CURLcode rtsp_do(struct Curl_easy *data, bool *done) here. */ if(Curl_checkheaders(data, STRCONST("User-Agent")) && data->state.aptr.uagent) { - Curl_safefree(data->state.aptr.uagent); + curlx_safefree(data->state.aptr.uagent); } else if(!Curl_checkheaders(data, STRCONST("User-Agent")) && data->set.str[STRING_USERAGENT]) { @@ -458,7 +458,7 @@ static CURLcode rtsp_do(struct Curl_easy *data, bool *done) p_userpwd = data->state.aptr.userpwd; /* Referrer */ - Curl_safefree(data->state.aptr.ref); + curlx_safefree(data->state.aptr.ref); if(Curl_bufref_ptr(&data->state.referer) && !Curl_checkheaders(data, STRCONST("Referer"))) data->state.aptr.ref = @@ -542,7 +542,7 @@ static CURLcode rtsp_do(struct Curl_easy *data, bool *done) * Free userpwd now --- cannot reuse this for Negotiate and possibly NTLM * with basic and digest, it will be freed anyway by the next request */ - Curl_safefree(data->state.aptr.userpwd); + curlx_safefree(data->state.aptr.userpwd); if(result) goto out; diff --git a/lib/setopt.c b/lib/setopt.c index bbc5ba457e..e2e854de7b 100644 --- a/lib/setopt.c +++ b/lib/setopt.c @@ -83,7 +83,7 @@ CURLcode Curl_setstropt(char **charp, const char *s) /* Release the previous storage at `charp' and replace by a dynamic storage copy of `s'. Return CURLE_OK or CURLE_OUT_OF_MEMORY. */ - Curl_safefree(*charp); + curlx_safefree(*charp); if(s) { if(strlen(s) > CURL_MAX_INPUT_LENGTH) @@ -103,7 +103,7 @@ CURLcode Curl_setblobopt(struct curl_blob **blobp, /* free the previous storage at `blobp' and replace by a dynamic storage copy of blob. If CURL_BLOB_COPY is set, the data is copied. */ - Curl_safefree(*blobp); + curlx_safefree(*blobp); if(blob) { struct curl_blob *nblob; @@ -1011,7 +1011,7 @@ static CURLcode setopt_long_ssl(struct Curl_easy *data, CURLoption option, case CURLOPT_SSL_ENABLE_NPN: break; case CURLOPT_SSLENGINE_DEFAULT: - Curl_safefree(s->str[STRING_SSL_ENGINE]); + curlx_safefree(s->str[STRING_SSL_ENGINE]); result = Curl_ssl_set_engine_default(data); break; default: @@ -1243,7 +1243,7 @@ static CURLcode setopt_long_misc(struct Curl_easy *data, CURLoption option, return CURLE_BAD_FUNCTION_ARGUMENT; if(s->postfieldsize < arg && s->postfields == s->str[STRING_COPYPOSTFIELDS]) { - Curl_safefree(s->str[STRING_COPYPOSTFIELDS]); + curlx_safefree(s->str[STRING_COPYPOSTFIELDS]); s->postfields = NULL; } s->postfieldsize = arg; @@ -1439,7 +1439,7 @@ static CURLcode setopt_mimepost(struct Curl_easy *data, curl_mime *mimep) s->opt_no_body = FALSE; /* this is implied */ #ifndef CURL_DISABLE_FORM_API Curl_mime_cleanpart(data->state.formp); - Curl_safefree(data->state.formp); + curlx_safefree(data->state.formp); data->state.mimepost = NULL; #endif } @@ -1465,7 +1465,7 @@ static CURLcode setopt_pointers(struct Curl_easy *data, CURLoption option, s->method = HTTPREQ_POST_FORM; s->opt_no_body = FALSE; /* this is implied */ Curl_mime_cleanpart(data->state.formp); - Curl_safefree(data->state.formp); + curlx_safefree(data->state.formp); data->state.mimepost = NULL; break; #endif /* !CURL_DISABLE_FORM_API */ @@ -1630,12 +1630,12 @@ static CURLcode setopt_cptr_proxy(struct Curl_easy *data, CURLoption option, /* URL decode the components */ if(!result && u) { - Curl_safefree(s->str[STRING_PROXYUSERNAME]); + curlx_safefree(s->str[STRING_PROXYUSERNAME]); result = Curl_urldecode(u, 0, &s->str[STRING_PROXYUSERNAME], NULL, REJECT_ZERO); } if(!result && p) { - Curl_safefree(s->str[STRING_PROXYPASSWORD]); + curlx_safefree(s->str[STRING_PROXYPASSWORD]); result = Curl_urldecode(p, 0, &s->str[STRING_PROXYPASSWORD], NULL, REJECT_ZERO); } @@ -1900,7 +1900,7 @@ static CURLcode setopt_cptr(struct Curl_easy *data, CURLoption option, */ s->postfields = ptr; /* Release old copied data. */ - Curl_safefree(s->str[STRING_COPYPOSTFIELDS]); + curlx_safefree(s->str[STRING_COPYPOSTFIELDS]); s->method = HTTPREQ_POST; break; #endif /* !CURL_DISABLE_HTTP || !CURL_DISABLE_MQTT */ @@ -2173,7 +2173,7 @@ static CURLcode setopt_cptr(struct Curl_easy *data, CURLoption option, * pass CURLU to set URL */ Curl_bufref_free(&data->state.url); - Curl_safefree(s->str[STRING_SET_URL]); + curlx_safefree(s->str[STRING_SET_URL]); s->uh = (CURLU *)ptr; break; case CURLOPT_SSLCERT: @@ -2721,7 +2721,7 @@ static CURLcode setopt_offt(struct Curl_easy *data, CURLoption option, if(s->postfieldsize < offt && s->postfields == s->str[STRING_COPYPOSTFIELDS]) { /* Previous CURLOPT_COPYPOSTFIELDS is no longer valid. */ - Curl_safefree(s->str[STRING_COPYPOSTFIELDS]); + curlx_safefree(s->str[STRING_COPYPOSTFIELDS]); s->postfields = NULL; } s->postfieldsize = offt; diff --git a/lib/slist.c b/lib/slist.c index c6dcdc1af0..83fd2918c6 100644 --- a/lib/slist.c +++ b/lib/slist.c @@ -132,7 +132,7 @@ void curl_slist_free_all(struct curl_slist *list) item = list; do { next = item->next; - Curl_safefree(item->data); + curlx_safefree(item->data); curlx_free(item); item = next; } while(next); diff --git a/lib/smb.c b/lib/smb.c index 47b9949540..6a97d2e006 100644 --- a/lib/smb.c +++ b/lib/smb.c @@ -376,7 +376,7 @@ static void smb_easy_dtor(void *key, size_t klen, void *entry) struct smb_request *req = entry; (void)key; (void)klen; - Curl_safefree(req->path); + curlx_safefree(req->path); curlx_free(req); } @@ -385,10 +385,10 @@ static void smb_conn_dtor(void *key, size_t klen, void *entry) struct smb_conn *smbc = entry; (void)key; (void)klen; - Curl_safefree(smbc->share); - Curl_safefree(smbc->domain); - Curl_safefree(smbc->recv_buf); - Curl_safefree(smbc->send_buf); + curlx_safefree(smbc->share); + curlx_safefree(smbc->domain); + curlx_safefree(smbc->recv_buf); + curlx_safefree(smbc->send_buf); curlx_free(smbc); } @@ -406,7 +406,7 @@ static CURLcode smb_parse_url_path(struct Curl_easy *data, return result; /* Parse the path for the share */ - Curl_safefree(smbc->share); + curlx_safefree(smbc->share); smbc->share = curlx_strdup((*path == '/' || *path == '\\') ? path + 1 : path); curlx_free(path); @@ -419,7 +419,7 @@ static CURLcode smb_parse_url_path(struct Curl_easy *data, /* The share must be present */ if(!slash) { - Curl_safefree(smbc->share); + curlx_safefree(smbc->share); failf(data, "missing share in URL path for SMB"); return CURLE_URL_MALFORMAT; } diff --git a/lib/smtp.c b/lib/smtp.c index 3f71ee97b1..d0d29afdac 100644 --- a/lib/smtp.c +++ b/lib/smtp.c @@ -1724,7 +1724,7 @@ static CURLcode smtp_done(struct Curl_easy *data, CURLcode status, return CURLE_OK; /* Cleanup our per-request based variables */ - Curl_safefree(smtp->custom); + curlx_safefree(smtp->custom); if(status) { connclose(conn, "SMTP done with bad status"); /* marked for closure */ @@ -1953,7 +1953,7 @@ static void smtp_conn_dtor(void *key, size_t klen, void *entry) (void)key; (void)klen; Curl_pp_disconnect(&smtpc->pp); - Curl_safefree(smtpc->domain); + curlx_safefree(smtpc->domain); curlx_free(smtpc); } diff --git a/lib/socks_gssapi.c b/lib/socks_gssapi.c index c40e2a23ee..b94471b622 100644 --- a/lib/socks_gssapi.c +++ b/lib/socks_gssapi.c @@ -156,7 +156,7 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(struct Curl_cfilter *cf, GSS_C_NT_HOSTBASED_SERVICE, &server); } - Curl_safefree(service.value); + curlx_safefree(service.value); service.length = 0; if(check_gss_err(data, gss_major_status, @@ -183,7 +183,7 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(struct Curl_cfilter *cf, &gss_ret_flags); if(gss_token != GSS_C_NO_BUFFER) { - Curl_safefree(gss_recv_token.value); + curlx_safefree(gss_recv_token.value); gss_recv_token.length = 0; } if(check_gss_err(data, gss_major_status, @@ -290,7 +290,7 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(struct Curl_cfilter *cf, if(result || (actualread != us_length)) { failf(data, "Failed to receive GSS-API authentication token."); gss_release_name(&gss_status, &server); - Curl_safefree(gss_recv_token.value); + curlx_safefree(gss_recv_token.value); gss_recv_token.length = 0; Curl_gss_delete_sec_context(&gss_status, &gss_context, NULL); return CURLE_COULDNT_CONNECT; @@ -392,14 +392,14 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(struct Curl_cfilter *cf, &gss_conf_state, &gss_w_token); if(check_gss_err(data, gss_major_status, gss_minor_status, "gss_wrap")) { - Curl_safefree(gss_send_token.value); + curlx_safefree(gss_send_token.value); gss_send_token.length = 0; gss_release_buffer(&gss_status, &gss_w_token); Curl_gss_delete_sec_context(&gss_status, &gss_context, NULL); failf(data, "Failed to wrap GSS-API encryption value into token."); return CURLE_COULDNT_CONNECT; } - Curl_safefree(gss_send_token.value); + curlx_safefree(gss_send_token.value); gss_send_token.length = 0; us_length = htons((unsigned short)gss_w_token.length); @@ -477,7 +477,7 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(struct Curl_cfilter *cf, if(result || (actualread != us_length)) { failf(data, "Failed to receive GSS-API encryption type."); - Curl_safefree(gss_recv_token.value); + curlx_safefree(gss_recv_token.value); gss_recv_token.length = 0; Curl_gss_delete_sec_context(&gss_status, &gss_context, NULL); return CURLE_COULDNT_CONNECT; @@ -489,14 +489,14 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(struct Curl_cfilter *cf, 0, GSS_C_QOP_DEFAULT); if(check_gss_err(data, gss_major_status, gss_minor_status, "gss_unwrap")) { - Curl_safefree(gss_recv_token.value); + curlx_safefree(gss_recv_token.value); gss_recv_token.length = 0; gss_release_buffer(&gss_status, &gss_w_token); Curl_gss_delete_sec_context(&gss_status, &gss_context, NULL); failf(data, "Failed to unwrap GSS-API encryption value into token."); return CURLE_COULDNT_CONNECT; } - Curl_safefree(gss_recv_token.value); + curlx_safefree(gss_recv_token.value); gss_recv_token.length = 0; if(gss_w_token.length != 1) { @@ -514,14 +514,14 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(struct Curl_cfilter *cf, if(gss_recv_token.length != 1) { failf(data, "Invalid GSS-API encryption response length (%zu).", gss_recv_token.length); - Curl_safefree(gss_recv_token.value); + curlx_safefree(gss_recv_token.value); gss_recv_token.length = 0; Curl_gss_delete_sec_context(&gss_status, &gss_context, NULL); return CURLE_COULDNT_CONNECT; } memcpy(socksreq, gss_recv_token.value, gss_recv_token.length); - Curl_safefree(gss_recv_token.value); + curlx_safefree(gss_recv_token.value); gss_recv_token.length = 0; } diff --git a/lib/socks_sspi.c b/lib/socks_sspi.c index 97ba15deaa..385312a368 100644 --- a/lib/socks_sspi.c +++ b/lib/socks_sspi.c @@ -159,7 +159,7 @@ static CURLcode socks5_sspi_loop(struct Curl_cfilter *cf, sspi_ret_flagsp, NULL); curlx_free(sname); - Curl_safefree(sspi_recv_token.pvBuffer); + curlx_safefree(sspi_recv_token.pvBuffer); sspi_recv_token.cbBuffer = 0; if(check_sspi_err(data, status, "InitializeSecurityContext")) { @@ -196,7 +196,7 @@ static CURLcode socks5_sspi_loop(struct Curl_cfilter *cf, socks5_free_token(&sspi_send_token, CURLE_OK); sspi_send_token.cbBuffer = 0; - Curl_safefree(sspi_recv_token.pvBuffer); + curlx_safefree(sspi_recv_token.pvBuffer); sspi_recv_token.cbBuffer = 0; if(status != SEC_I_CONTINUE_NEEDED) @@ -252,9 +252,9 @@ static CURLcode socks5_sspi_loop(struct Curl_cfilter *cf, static CURLcode socks5_free(SecBuffer *sspi_w_token, CURLcode result) { - Curl_safefree(sspi_w_token[0].pvBuffer); - Curl_safefree(sspi_w_token[1].pvBuffer); - Curl_safefree(sspi_w_token[2].pvBuffer); + curlx_safefree(sspi_w_token[0].pvBuffer); + curlx_safefree(sspi_w_token[1].pvBuffer); + curlx_safefree(sspi_w_token[2].pvBuffer); return result; } @@ -498,7 +498,7 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(struct Curl_cfilter *cf, if(result) goto error; - Curl_safefree(service_name); + curlx_safefree(service_name); status = Curl_pSecFn->QueryCredentialsAttributes(&cred_handle, SECPKG_CRED_ATTR_NAMES, diff --git a/lib/tftp.c b/lib/tftp.c index 16746ab68f..dd006fb1cf 100644 --- a/lib/tftp.c +++ b/lib/tftp.c @@ -883,8 +883,8 @@ static void tftp_conn_dtor(void *key, size_t klen, void *entry) struct tftp_conn *state = entry; (void)key; (void)klen; - Curl_safefree(state->rpacket.data); - Curl_safefree(state->spacket.data); + curlx_safefree(state->rpacket.data); + curlx_safefree(state->spacket.data); curlx_free(state); } diff --git a/lib/transfer.c b/lib/transfer.c index 2eb8f22511..dd4e16b7f5 100644 --- a/lib/transfer.c +++ b/lib/transfer.c @@ -501,7 +501,7 @@ CURLcode Curl_pretransfer(struct Curl_easy *data) data->state.authproblem = FALSE; data->state.authhost.want = data->set.httpauth; data->state.authproxy.want = data->set.proxyauth; - Curl_safefree(data->info.wouldredirect); + curlx_safefree(data->info.wouldredirect); Curl_data_priority_clear_state(data); if(data->state.httpreq == HTTPREQ_PUT) @@ -565,8 +565,8 @@ CURLcode Curl_pretransfer(struct Curl_easy *data) if(wc->state < CURLWC_INIT) { if(wc->ftpwc) wc->dtor(wc->ftpwc); - Curl_safefree(wc->pattern); - Curl_safefree(wc->path); + curlx_safefree(wc->pattern); + curlx_safefree(wc->path); Curl_wildcard_init(wc); /* init wildcard structures */ } } diff --git a/lib/uint-hash.c b/lib/uint-hash.c index d9aeffdf2c..b7535b6242 100644 --- a/lib/uint-hash.c +++ b/lib/uint-hash.c @@ -204,7 +204,7 @@ void Curl_uint32_hash_destroy(struct uint_hash *h) DEBUGASSERT(h->init == CURL_UINT32_HASHINIT); if(h->table) { uint_hash_clear(h); - Curl_safefree(h->table); + curlx_safefree(h->table); } DEBUGASSERT(h->size == 0); h->slots = 0; diff --git a/lib/url.c b/lib/url.c index 037d41390b..db82b6a070 100644 --- a/lib/url.c +++ b/lib/url.c @@ -160,11 +160,11 @@ void Curl_freeset(struct Curl_easy *data) enum dupblob j; for(i = (enum dupstring)0; i < STRING_LAST; i++) { - Curl_safefree(data->set.str[i]); + curlx_safefree(data->set.str[i]); } for(j = (enum dupblob)0; j < BLOB_LAST; j++) { - Curl_safefree(data->set.blobs[j]); + curlx_safefree(data->set.blobs[j]); } Curl_bufref_free(&data->state.referer); @@ -172,7 +172,7 @@ void Curl_freeset(struct Curl_easy *data) #if !defined(CURL_DISABLE_MIME) || !defined(CURL_DISABLE_FORM_API) Curl_mime_cleanpart(data->set.mimepostp); - Curl_safefree(data->set.mimepostp); + curlx_safefree(data->set.mimepostp); #endif #ifndef CURL_DISABLE_COOKIES @@ -185,14 +185,14 @@ void Curl_freeset(struct Curl_easy *data) static void up_free(struct Curl_easy *data) { struct urlpieces *up = &data->state.up; - Curl_safefree(up->scheme); - Curl_safefree(up->hostname); - Curl_safefree(up->port); - Curl_safefree(up->user); - Curl_safefree(up->password); - Curl_safefree(up->options); - Curl_safefree(up->path); - Curl_safefree(up->query); + curlx_safefree(up->scheme); + curlx_safefree(up->hostname); + curlx_safefree(up->port); + curlx_safefree(up->user); + curlx_safefree(up->password); + curlx_safefree(up->options); + curlx_safefree(up->path); + curlx_safefree(up->query); curl_url_cleanup(data->state.uh); data->state.uh = NULL; } @@ -252,7 +252,7 @@ CURLcode Curl_close(struct Curl_easy **datap) /* Close down all open SSL info and sessions */ Curl_ssl_close_all(data); - Curl_safefree(data->state.first_host); + curlx_safefree(data->state.first_host); Curl_ssl_free_certinfo(data); Curl_bufref_free(&data->state.referer); @@ -273,9 +273,9 @@ CURLcode Curl_close(struct Curl_easy **datap) #if !defined(CURL_DISABLE_HTTP) && !defined(CURL_DISABLE_DIGEST_AUTH) Curl_http_auth_cleanup_digest(data); #endif - Curl_safefree(data->state.most_recent_ftp_entrypath); - Curl_safefree(data->info.contenttype); - Curl_safefree(data->info.wouldredirect); + curlx_safefree(data->state.most_recent_ftp_entrypath); + curlx_safefree(data->info.contenttype); + curlx_safefree(data->info.wouldredirect); data_priority_cleanup(data); @@ -285,30 +285,30 @@ CURLcode Curl_close(struct Curl_easy **datap) Curl_hash_destroy(&data->meta_hash); #ifndef CURL_DISABLE_PROXY - Curl_safefree(data->state.aptr.proxyuserpwd); -#endif - Curl_safefree(data->state.aptr.uagent); - Curl_safefree(data->state.aptr.userpwd); - Curl_safefree(data->state.aptr.accept_encoding); - Curl_safefree(data->state.aptr.rangeline); - Curl_safefree(data->state.aptr.ref); - Curl_safefree(data->state.aptr.host); + curlx_safefree(data->state.aptr.proxyuserpwd); +#endif + curlx_safefree(data->state.aptr.uagent); + curlx_safefree(data->state.aptr.userpwd); + curlx_safefree(data->state.aptr.accept_encoding); + curlx_safefree(data->state.aptr.rangeline); + curlx_safefree(data->state.aptr.ref); + curlx_safefree(data->state.aptr.host); #ifndef CURL_DISABLE_COOKIES - Curl_safefree(data->state.aptr.cookiehost); + curlx_safefree(data->state.aptr.cookiehost); #endif #ifndef CURL_DISABLE_RTSP - Curl_safefree(data->state.aptr.rtsp_transport); + curlx_safefree(data->state.aptr.rtsp_transport); #endif - Curl_safefree(data->state.aptr.user); - Curl_safefree(data->state.aptr.passwd); + curlx_safefree(data->state.aptr.user); + curlx_safefree(data->state.aptr.passwd); #ifndef CURL_DISABLE_PROXY - Curl_safefree(data->state.aptr.proxyuser); - Curl_safefree(data->state.aptr.proxypasswd); + curlx_safefree(data->state.aptr.proxyuser); + curlx_safefree(data->state.aptr.proxypasswd); #endif #if !defined(CURL_DISABLE_HTTP) && !defined(CURL_DISABLE_FORM_API) Curl_mime_cleanpart(data->state.formp); - Curl_safefree(data->state.formp); + curlx_safefree(data->state.formp); #endif /* destruct wildcard structures if it is needed */ @@ -521,28 +521,28 @@ void Curl_conn_free(struct Curl_easy *data, struct connectdata *conn) #ifndef CURL_DISABLE_PROXY Curl_free_idnconverted_hostname(&conn->http_proxy.host); Curl_free_idnconverted_hostname(&conn->socks_proxy.host); - Curl_safefree(conn->http_proxy.user); - Curl_safefree(conn->socks_proxy.user); - Curl_safefree(conn->http_proxy.passwd); - Curl_safefree(conn->socks_proxy.passwd); - Curl_safefree(conn->http_proxy.host.rawalloc); /* http proxy name buffer */ - Curl_safefree(conn->socks_proxy.host.rawalloc); /* socks proxy name buffer */ -#endif - Curl_safefree(conn->user); - Curl_safefree(conn->passwd); - Curl_safefree(conn->sasl_authzid); - Curl_safefree(conn->options); - Curl_safefree(conn->oauth_bearer); - Curl_safefree(conn->host.rawalloc); /* hostname buffer */ - Curl_safefree(conn->conn_to_host.rawalloc); /* hostname buffer */ - Curl_safefree(conn->secondaryhostname); - Curl_safefree(conn->localdev); + curlx_safefree(conn->http_proxy.user); + curlx_safefree(conn->socks_proxy.user); + curlx_safefree(conn->http_proxy.passwd); + curlx_safefree(conn->socks_proxy.passwd); + curlx_safefree(conn->http_proxy.host.rawalloc); /* http proxy name */ + curlx_safefree(conn->socks_proxy.host.rawalloc); /* socks proxy name */ +#endif + curlx_safefree(conn->user); + curlx_safefree(conn->passwd); + curlx_safefree(conn->sasl_authzid); + curlx_safefree(conn->options); + curlx_safefree(conn->oauth_bearer); + curlx_safefree(conn->host.rawalloc); /* hostname buffer */ + curlx_safefree(conn->conn_to_host.rawalloc); /* hostname buffer */ + curlx_safefree(conn->secondaryhostname); + curlx_safefree(conn->localdev); Curl_ssl_conn_config_cleanup(conn); #ifdef USE_UNIX_SOCKETS - Curl_safefree(conn->unix_domain_socket); + curlx_safefree(conn->unix_domain_socket); #endif - Curl_safefree(conn->destination); + curlx_safefree(conn->destination); Curl_hash_destroy(&conn->meta_hash); curlx_free(conn); /* free all the connection oriented data */ @@ -1622,7 +1622,7 @@ static CURLcode parseurlandfillconn(struct Curl_easy *data, /* This MUST use the IDN decoded name */ if(Curl_hsts(data->hsts, conn->host.name, strlen(conn->host.name), TRUE)) { char *url; - Curl_safefree(data->state.up.scheme); + curlx_safefree(data->state.up.scheme); uc = curl_url_set(uh, CURLUPART_SCHEME, "https", 0); if(uc) return Curl_uc_to_curlcode(uc); @@ -2025,7 +2025,7 @@ static CURLcode parse_proxy(struct Curl_easy *data, proxyuser = NULL; if(result) goto error; - Curl_safefree(proxyinfo->passwd); + curlx_safefree(proxyinfo->passwd); if(!proxypasswd) { proxypasswd = curlx_strdup(""); if(!proxypasswd) { @@ -2144,7 +2144,7 @@ static CURLcode parse_proxy_auth(struct Curl_easy *data, if(conn->http_proxy.passwd) result = CURLE_OK; else - Curl_safefree(conn->http_proxy.user); + curlx_safefree(conn->http_proxy.user); } return result; } @@ -2205,15 +2205,15 @@ static CURLcode create_conn_helper_init_proxy(struct Curl_easy *data, if(Curl_check_noproxy(conn->host.name, data->set.str[STRING_NOPROXY] ? data->set.str[STRING_NOPROXY] : no_proxy)) { - Curl_safefree(proxy); - Curl_safefree(socksproxy); + curlx_safefree(proxy); + curlx_safefree(socksproxy); } #ifndef CURL_DISABLE_HTTP else if(!proxy && !socksproxy) /* if the host is not in the noproxy list, detect proxy. */ proxy = detect_proxy(data, conn); #endif /* CURL_DISABLE_HTTP */ - Curl_safefree(no_proxy); + curlx_safefree(no_proxy); #ifdef USE_UNIX_SOCKETS /* For the time being do not mix proxy and Unix domain sockets. See #1274 */ @@ -2244,7 +2244,7 @@ static CURLcode create_conn_helper_init_proxy(struct Curl_easy *data, if(proxy || socksproxy) { if(proxy) { result = parse_proxy(data, conn, proxy, conn->http_proxy.proxytype); - Curl_safefree(proxy); /* parse_proxy copies the proxy string */ + curlx_safefree(proxy); /* parse_proxy copies the proxy string */ if(result) goto out; } @@ -2253,7 +2253,7 @@ static CURLcode create_conn_helper_init_proxy(struct Curl_easy *data, result = parse_proxy(data, conn, socksproxy, conn->socks_proxy.proxytype); /* parse_proxy copies the socks proxy string */ - Curl_safefree(socksproxy); + curlx_safefree(socksproxy); if(result) goto out; } @@ -2478,8 +2478,8 @@ static CURLcode override_login(struct Curl_easy *data, #ifndef CURL_DISABLE_NETRC if(data->set.use_netrc == CURL_NETRC_REQUIRED) { - Curl_safefree(*userp); - Curl_safefree(*passwdp); + curlx_safefree(*userp); + curlx_safefree(*passwdp); } conn->bits.netrc = FALSE; if(data->set.use_netrc && !data->set.str[STRING_USERNAME]) { @@ -2809,7 +2809,7 @@ static CURLcode parse_connect_to_slist(struct Curl_easy *data, else { /* no "connect to host" */ conn->bits.conn_to_host = FALSE; - Curl_safefree(host); + curlx_safefree(host); } if(port >= 0) { @@ -2947,7 +2947,7 @@ static CURLcode parse_connect_to_slist(struct Curl_easy *data, static void url_move_hostname(struct hostname *dest, struct hostname *src) { - Curl_safefree(dest->rawalloc); + curlx_safefree(dest->rawalloc); Curl_free_idnconverted_hostname(dest); *dest = *src; memset(src, 0, sizeof(*src)); diff --git a/lib/urlapi.c b/lib/urlapi.c index 52e3ba5555..846e7ebf2e 100644 --- a/lib/urlapi.c +++ b/lib/urlapi.c @@ -1739,37 +1739,37 @@ static CURLUcode urlset_clear(CURLU *u, CURLUPart what) memset(u, 0, sizeof(struct Curl_URL)); break; case CURLUPART_SCHEME: - Curl_safefree(u->scheme); + curlx_safefree(u->scheme); u->guessed_scheme = FALSE; break; case CURLUPART_USER: - Curl_safefree(u->user); + curlx_safefree(u->user); break; case CURLUPART_PASSWORD: - Curl_safefree(u->password); + curlx_safefree(u->password); break; case CURLUPART_OPTIONS: - Curl_safefree(u->options); + curlx_safefree(u->options); break; case CURLUPART_HOST: - Curl_safefree(u->host); + curlx_safefree(u->host); break; case CURLUPART_ZONEID: - Curl_safefree(u->zoneid); + curlx_safefree(u->zoneid); break; case CURLUPART_PORT: u->portnum = 0; - Curl_safefree(u->port); + curlx_safefree(u->port); break; case CURLUPART_PATH: - Curl_safefree(u->path); + curlx_safefree(u->path); break; case CURLUPART_QUERY: - Curl_safefree(u->query); + curlx_safefree(u->query); u->query_present = FALSE; break; case CURLUPART_FRAGMENT: - Curl_safefree(u->fragment); + curlx_safefree(u->fragment); u->fragment_present = FALSE; break; default: @@ -1847,7 +1847,7 @@ CURLUcode curl_url_set(CURLU *u, CURLUPart what, break; case CURLUPART_HOST: storep = &u->host; - Curl_safefree(u->zoneid); + curlx_safefree(u->zoneid); break; case CURLUPART_ZONEID: storep = &u->zoneid; diff --git a/lib/vauth/digest.c b/lib/vauth/digest.c index 33b0ef2160..5ecfd60aad 100644 --- a/lib/vauth/digest.c +++ b/lib/vauth/digest.c @@ -1031,12 +1031,12 @@ CURLcode Curl_auth_create_digest_http_message(struct Curl_easy *data, */ void Curl_auth_digest_cleanup(struct digestdata *digest) { - Curl_safefree(digest->nonce); - Curl_safefree(digest->cnonce); - Curl_safefree(digest->realm); - Curl_safefree(digest->opaque); - Curl_safefree(digest->qop); - Curl_safefree(digest->algorithm); + curlx_safefree(digest->nonce); + curlx_safefree(digest->cnonce); + curlx_safefree(digest->realm); + curlx_safefree(digest->opaque); + curlx_safefree(digest->qop); + curlx_safefree(digest->algorithm); digest->nc = 0; digest->algo = ALGO_MD5; /* default algorithm */ diff --git a/lib/vauth/digest_sspi.c b/lib/vauth/digest_sspi.c index cb9d4093d2..f0b6780fca 100644 --- a/lib/vauth/digest_sspi.c +++ b/lib/vauth/digest_sspi.c @@ -427,10 +427,10 @@ CURLcode Curl_auth_create_digest_http_message(struct Curl_easy *data, (passwdp && digest->passwd && Curl_timestrcmp(passwdp, digest->passwd))) { if(digest->http_context) { Curl_pSecFn->DeleteSecurityContext(digest->http_context); - Curl_safefree(digest->http_context); + curlx_safefree(digest->http_context); } - Curl_safefree(digest->user); - Curl_safefree(digest->passwd); + curlx_safefree(digest->user); + curlx_safefree(digest->passwd); } if(digest->http_context) { @@ -460,7 +460,7 @@ CURLcode Curl_auth_create_digest_http_message(struct Curl_easy *data, else { /* delete the context so a new one can be made */ infof(data, "digest_sspi: MakeSignature failed, error 0x%08lx", status); Curl_pSecFn->DeleteSecurityContext(digest->http_context); - Curl_safefree(digest->http_context); + curlx_safefree(digest->http_context); } } @@ -474,8 +474,8 @@ CURLcode Curl_auth_create_digest_http_message(struct Curl_easy *data, TCHAR *spn; /* free the copy of user/passwd used to make the previous identity */ - Curl_safefree(digest->user); - Curl_safefree(digest->passwd); + curlx_safefree(digest->user); + curlx_safefree(digest->passwd); if(userp && *userp) { /* Populate our identity structure */ @@ -515,7 +515,7 @@ CURLcode Curl_auth_create_digest_http_message(struct Curl_easy *data, if(!digest->passwd) { curlx_free(output_token); Curl_sspi_free_identity(p_identity); - Curl_safefree(digest->user); + curlx_safefree(digest->user); return CURLE_OUT_OF_MEMORY; } } @@ -595,7 +595,7 @@ CURLcode Curl_auth_create_digest_http_message(struct Curl_easy *data, Curl_sspi_free_identity(p_identity); curlx_free(output_token); - Curl_safefree(digest->http_context); + curlx_safefree(digest->http_context); if(status == SEC_E_INSUFFICIENT_MEMORY) return CURLE_OUT_OF_MEMORY; @@ -637,7 +637,7 @@ CURLcode Curl_auth_create_digest_http_message(struct Curl_easy *data, void Curl_auth_digest_cleanup(struct digestdata *digest) { /* Free the input token */ - Curl_safefree(digest->input_token); + curlx_safefree(digest->input_token); /* Reset any variables */ digest->input_token_len = 0; @@ -645,12 +645,12 @@ void Curl_auth_digest_cleanup(struct digestdata *digest) /* Delete security context */ if(digest->http_context) { Curl_pSecFn->DeleteSecurityContext(digest->http_context); - Curl_safefree(digest->http_context); + curlx_safefree(digest->http_context); } /* Free the copy of user/passwd used to make the identity for http_context */ - Curl_safefree(digest->user); - Curl_safefree(digest->passwd); + curlx_safefree(digest->user); + curlx_safefree(digest->passwd); } #endif /* USE_WINDOWS_SSPI && !CURL_DISABLE_DIGEST_AUTH */ diff --git a/lib/vauth/krb5_sspi.c b/lib/vauth/krb5_sspi.c index c08b6a4c3a..e7491be022 100644 --- a/lib/vauth/krb5_sspi.c +++ b/lib/vauth/krb5_sspi.c @@ -444,8 +444,8 @@ void Curl_auth_cleanup_gssapi(struct kerberos5data *krb5) krb5->p_identity = NULL; /* Free the SPN and output token */ - Curl_safefree(krb5->spn); - Curl_safefree(krb5->output_token); + curlx_safefree(krb5->spn); + curlx_safefree(krb5->output_token); /* Reset any variables */ krb5->token_max = 0; diff --git a/lib/vauth/ntlm.c b/lib/vauth/ntlm.c index 54719cb10a..afd165bc9a 100644 --- a/lib/vauth/ntlm.c +++ b/lib/vauth/ntlm.c @@ -850,7 +850,7 @@ error: void Curl_auth_cleanup_ntlm(struct ntlmdata *ntlm) { /* Free the target info */ - Curl_safefree(ntlm->target_info); + curlx_safefree(ntlm->target_info); /* Reset any variables */ ntlm->target_info_len = 0; diff --git a/lib/vauth/ntlm_sspi.c b/lib/vauth/ntlm_sspi.c index 06663ae58a..8a0e45ea65 100644 --- a/lib/vauth/ntlm_sspi.c +++ b/lib/vauth/ntlm_sspi.c @@ -341,13 +341,13 @@ void Curl_auth_cleanup_ntlm(struct ntlmdata *ntlm) ntlm->p_identity = NULL; /* Free the input and output tokens */ - Curl_safefree(ntlm->input_token); - Curl_safefree(ntlm->output_token); + curlx_safefree(ntlm->input_token); + curlx_safefree(ntlm->output_token); /* Reset any variables */ ntlm->token_max = 0; - Curl_safefree(ntlm->spn); + curlx_safefree(ntlm->spn); } #endif /* USE_WINDOWS_SSPI && USE_NTLM */ diff --git a/lib/vauth/spnego_gssapi.c b/lib/vauth/spnego_gssapi.c index 4dca3ac033..38bb4c1422 100644 --- a/lib/vauth/spnego_gssapi.c +++ b/lib/vauth/spnego_gssapi.c @@ -171,7 +171,7 @@ CURLcode Curl_auth_decode_spnego_message(struct Curl_easy *data, NULL); /* Free the decoded challenge as it is not required anymore */ - Curl_safefree(input_token.value); + curlx_safefree(input_token.value); nego->status = major_status; if(GSS_ERROR(major_status)) { diff --git a/lib/vauth/spnego_sspi.c b/lib/vauth/spnego_sspi.c index 568eef522b..1baf59320a 100644 --- a/lib/vauth/spnego_sspi.c +++ b/lib/vauth/spnego_sspi.c @@ -329,8 +329,8 @@ void Curl_auth_cleanup_spnego(struct negotiatedata *nego) nego->p_identity = NULL; /* Free the SPN and output token */ - Curl_safefree(nego->spn); - Curl_safefree(nego->output_token); + curlx_safefree(nego->spn); + curlx_safefree(nego->output_token); /* Reset any variables */ nego->status = 0; diff --git a/lib/vssh/libssh.c b/lib/vssh/libssh.c index 4fc9ed8041..13a987dec7 100644 --- a/lib/vssh/libssh.c +++ b/lib/vssh/libssh.c @@ -480,7 +480,7 @@ static int myssh_in_SFTP_READDIR_LINK(struct Curl_easy *data, sshc->readdir_longentry = sshc->readdir_link_attrs->longname; } - Curl_safefree(sshc->readdir_linkPath); + curlx_safefree(sshc->readdir_linkPath); if(curlx_dyn_addf(&sshc->readdir_buf, " -> %s", sshc->readdir_filename)) { /* Not using: @@ -546,8 +546,8 @@ static void myssh_quote_error(struct Curl_easy *data, struct ssh_conn *sshc, if(cmd) failf(data, "%s command failed: %s", cmd, ssh_get_error(sshc->ssh_session)); - Curl_safefree(sshc->quote_path1); - Curl_safefree(sshc->quote_path2); + curlx_safefree(sshc->quote_path1); + curlx_safefree(sshc->quote_path2); myssh_to(data, sshc, SSH_SFTP_CLOSE); sshc->nextstate = SSH_NO_STATE; sshc->actualcode = CURLE_QUOTE_ERROR; @@ -1224,7 +1224,7 @@ static int myssh_in_SFTP_CLOSE(struct Curl_easy *data, sftp_close(sshc->sftp_file); sshc->sftp_file = NULL; } - Curl_safefree(sshp->path); + curlx_safefree(sshp->path); CURL_TRC_SSH(data, "SFTP DONE done"); @@ -1352,8 +1352,8 @@ static int quote_error(struct Curl_easy *data, struct ssh_conn *sshc) { failf(data, "Suspicious data after the command line"); - Curl_safefree(sshc->quote_path1); - Curl_safefree(sshc->quote_path2); + curlx_safefree(sshc->quote_path1); + curlx_safefree(sshc->quote_path2); myssh_to(data, sshc, SSH_SFTP_CLOSE); sshc->nextstate = SSH_NO_STATE; sshc->actualcode = CURLE_QUOTE_ERROR; @@ -1462,7 +1462,7 @@ static int myssh_in_SFTP_QUOTE(struct Curl_easy *data, else failf(data, "Syntax error in chgrp/chmod/chown/atime/mtime: " "Bad second parameter"); - Curl_safefree(sshc->quote_path1); + curlx_safefree(sshc->quote_path1); myssh_to(data, sshc, SSH_SFTP_CLOSE); sshc->nextstate = SSH_NO_STATE; sshc->actualcode = result; @@ -1485,7 +1485,7 @@ static int myssh_in_SFTP_QUOTE(struct Curl_easy *data, failf(data, "Out of memory"); else failf(data, "Syntax error in ln/symlink: Bad second parameter"); - Curl_safefree(sshc->quote_path1); + curlx_safefree(sshc->quote_path1); myssh_to(data, sshc, SSH_SFTP_CLOSE); sshc->nextstate = SSH_NO_STATE; sshc->actualcode = result; @@ -1513,7 +1513,7 @@ static int myssh_in_SFTP_QUOTE(struct Curl_easy *data, failf(data, "Out of memory"); else failf(data, "Syntax error in rename: Bad second parameter"); - Curl_safefree(sshc->quote_path1); + curlx_safefree(sshc->quote_path1); myssh_to(data, sshc, SSH_SFTP_CLOSE); sshc->nextstate = SSH_NO_STATE; sshc->actualcode = result; @@ -1547,8 +1547,8 @@ static int myssh_in_SFTP_QUOTE(struct Curl_easy *data, #endif failf(data, "Unknown SFTP command"); - Curl_safefree(sshc->quote_path1); - Curl_safefree(sshc->quote_path2); + curlx_safefree(sshc->quote_path1); + curlx_safefree(sshc->quote_path2); myssh_to(data, sshc, SSH_SFTP_CLOSE); sshc->nextstate = SSH_NO_STATE; sshc->actualcode = CURLE_QUOTE_ERROR; @@ -1558,8 +1558,8 @@ static int myssh_in_SFTP_QUOTE(struct Curl_easy *data, static int myssh_in_SFTP_NEXT_QUOTE(struct Curl_easy *data, struct ssh_conn *sshc) { - Curl_safefree(sshc->quote_path1); - Curl_safefree(sshc->quote_path2); + curlx_safefree(sshc->quote_path1); + curlx_safefree(sshc->quote_path2); sshc->quote_item = sshc->quote_item->next; @@ -1832,12 +1832,12 @@ static void sshc_cleanup(struct ssh_conn *sshc) sshc->pubkey = NULL; } - Curl_safefree(sshc->rsa_pub); - Curl_safefree(sshc->rsa); - Curl_safefree(sshc->quote_path1); - Curl_safefree(sshc->quote_path2); + curlx_safefree(sshc->rsa_pub); + curlx_safefree(sshc->rsa); + curlx_safefree(sshc->quote_path1); + curlx_safefree(sshc->quote_path2); curlx_dyn_free(&sshc->readdir_buf); - Curl_safefree(sshc->readdir_linkPath); + curlx_safefree(sshc->readdir_linkPath); SSH_STRING_FREE_CHAR(sshc->homedir); sshc->initialised = FALSE; } @@ -2350,7 +2350,7 @@ static void myssh_easy_dtor(void *key, size_t klen, void *entry) struct SSHPROTO *sshp = entry; (void)key; (void)klen; - Curl_safefree(sshp->path); + curlx_safefree(sshp->path); curlx_free(sshp); } diff --git a/lib/vssh/libssh2.c b/lib/vssh/libssh2.c index e8723f7547..e733999387 100644 --- a/lib/vssh/libssh2.c +++ b/lib/vssh/libssh2.c @@ -719,8 +719,8 @@ static CURLcode quote_error(struct Curl_easy *data, struct ssh_conn *sshc) { failf(data, "Suspicious data after the command line"); - Curl_safefree(sshc->quote_path1); - Curl_safefree(sshc->quote_path2); + curlx_safefree(sshc->quote_path1); + curlx_safefree(sshc->quote_path2); return CURLE_QUOTE_ERROR; } @@ -808,7 +808,7 @@ static CURLcode sftp_quote(struct Curl_easy *data, if(result) { if(result != CURLE_OUT_OF_MEMORY) failf(data, "Syntax error in %s: Bad second parameter", cmd); - Curl_safefree(sshc->quote_path1); + curlx_safefree(sshc->quote_path1); return result; } if(*cp) @@ -827,7 +827,7 @@ static CURLcode sftp_quote(struct Curl_easy *data, if(result) { if(result != CURLE_OUT_OF_MEMORY) failf(data, "Syntax error in ln/symlink: Bad second parameter"); - Curl_safefree(sshc->quote_path1); + curlx_safefree(sshc->quote_path1); return result; } if(*cp) @@ -850,7 +850,7 @@ static CURLcode sftp_quote(struct Curl_easy *data, if(result) { if(result != CURLE_OUT_OF_MEMORY) failf(data, "Syntax error in rename: Bad second parameter"); - Curl_safefree(sshc->quote_path1); + curlx_safefree(sshc->quote_path1); return result; } if(*cp) @@ -879,8 +879,8 @@ static CURLcode sftp_quote(struct Curl_easy *data, } failf(data, "Unknown SFTP command"); - Curl_safefree(sshc->quote_path1); - Curl_safefree(sshc->quote_path2); + curlx_safefree(sshc->quote_path1); + curlx_safefree(sshc->quote_path2); return CURLE_QUOTE_ERROR; } @@ -1103,7 +1103,7 @@ static CURLcode ssh_state_pkey_init(struct Curl_easy *data, if(!sshc->rsa) out_of_memory = TRUE; else if(curlx_stat(sshc->rsa, &sbuf)) { - Curl_safefree(sshc->rsa); + curlx_safefree(sshc->rsa); } } curlx_free(home); @@ -1138,8 +1138,8 @@ static CURLcode ssh_state_pkey_init(struct Curl_easy *data, } if(out_of_memory || !sshc->rsa) { - Curl_safefree(sshc->rsa); - Curl_safefree(sshc->rsa_pub); + curlx_safefree(sshc->rsa); + curlx_safefree(sshc->rsa_pub); myssh_to(data, sshc, SSH_SESSION_FREE); return CURLE_OUT_OF_MEMORY; } @@ -1266,8 +1266,8 @@ static CURLcode sftp_quote_stat(struct Curl_easy *data, myssh_to(data, sshc, SSH_SFTP_QUOTE_SETSTAT); return CURLE_OK; fail: - Curl_safefree(sshc->quote_path1); - Curl_safefree(sshc->quote_path2); + curlx_safefree(sshc->quote_path1); + curlx_safefree(sshc->quote_path2); return CURLE_QUOTE_ERROR; } @@ -1535,8 +1535,8 @@ static CURLcode ssh_state_auth_pkey(struct Curl_easy *data, if(rc == LIBSSH2_ERROR_EAGAIN) return CURLE_AGAIN; - Curl_safefree(sshc->rsa_pub); - Curl_safefree(sshc->rsa); + curlx_safefree(sshc->rsa_pub); + curlx_safefree(sshc->rsa); if(rc == 0) { sshc->authed = TRUE; @@ -1891,8 +1891,8 @@ static CURLcode ssh_state_sftp_quote(struct Curl_easy *data, static CURLcode ssh_state_sftp_next_quote(struct Curl_easy *data, struct ssh_conn *sshc) { - Curl_safefree(sshc->quote_path1); - Curl_safefree(sshc->quote_path2); + curlx_safefree(sshc->quote_path1); + curlx_safefree(sshc->quote_path2); sshc->quote_item = sshc->quote_item->next; @@ -1940,8 +1940,8 @@ static CURLcode ssh_state_sftp_quote_setstat(struct Curl_easy *data, unsigned long sftperr = libssh2_sftp_last_error(sshc->sftp_session); failf(data, "Attempt to set SFTP stats for \"%s\" failed: %s", sshc->quote_path2, sftp_libssh2_strerror(sftperr)); - Curl_safefree(sshc->quote_path1); - Curl_safefree(sshc->quote_path2); + curlx_safefree(sshc->quote_path1); + curlx_safefree(sshc->quote_path2); myssh_to(data, sshc, SSH_SFTP_CLOSE); sshc->nextstate = SSH_NO_STATE; return CURLE_QUOTE_ERROR; @@ -1967,8 +1967,8 @@ static CURLcode ssh_state_sftp_quote_symlink(struct Curl_easy *data, failf(data, "symlink \"%s\" to \"%s\" failed: %s", sshc->quote_path1, sshc->quote_path2, sftp_libssh2_strerror(sftperr)); - Curl_safefree(sshc->quote_path1); - Curl_safefree(sshc->quote_path2); + curlx_safefree(sshc->quote_path1); + curlx_safefree(sshc->quote_path2); myssh_to(data, sshc, SSH_SFTP_CLOSE); sshc->nextstate = SSH_NO_STATE; return CURLE_QUOTE_ERROR; @@ -1990,7 +1990,7 @@ static CURLcode ssh_state_sftp_quote_mkdir(struct Curl_easy *data, unsigned long sftperr = libssh2_sftp_last_error(sshc->sftp_session); failf(data, "mkdir \"%s\" failed: %s", sshc->quote_path1, sftp_libssh2_strerror(sftperr)); - Curl_safefree(sshc->quote_path1); + curlx_safefree(sshc->quote_path1); myssh_to(data, sshc, SSH_SFTP_CLOSE); sshc->nextstate = SSH_NO_STATE; return CURLE_QUOTE_ERROR; @@ -2019,8 +2019,8 @@ static CURLcode ssh_state_sftp_quote_rename(struct Curl_easy *data, failf(data, "rename \"%s\" to \"%s\" failed: %s", sshc->quote_path1, sshc->quote_path2, sftp_libssh2_strerror(sftperr)); - Curl_safefree(sshc->quote_path1); - Curl_safefree(sshc->quote_path2); + curlx_safefree(sshc->quote_path1); + curlx_safefree(sshc->quote_path2); myssh_to(data, sshc, SSH_SFTP_CLOSE); sshc->nextstate = SSH_NO_STATE; return CURLE_QUOTE_ERROR; @@ -2041,7 +2041,7 @@ static CURLcode ssh_state_sftp_quote_rmdir(struct Curl_easy *data, unsigned long sftperr = libssh2_sftp_last_error(sshc->sftp_session); failf(data, "rmdir \"%s\" failed: %s", sshc->quote_path1, sftp_libssh2_strerror(sftperr)); - Curl_safefree(sshc->quote_path1); + curlx_safefree(sshc->quote_path1); myssh_to(data, sshc, SSH_SFTP_CLOSE); sshc->nextstate = SSH_NO_STATE; return CURLE_QUOTE_ERROR; @@ -2062,7 +2062,7 @@ static CURLcode ssh_state_sftp_quote_unlink(struct Curl_easy *data, unsigned long sftperr = libssh2_sftp_last_error(sshc->sftp_session); failf(data, "rm \"%s\" failed: %s", sshc->quote_path1, sftp_libssh2_strerror(sftperr)); - Curl_safefree(sshc->quote_path1); + curlx_safefree(sshc->quote_path1); myssh_to(data, sshc, SSH_SFTP_CLOSE); sshc->nextstate = SSH_NO_STATE; return CURLE_QUOTE_ERROR; @@ -2086,7 +2086,7 @@ static CURLcode ssh_state_sftp_quote_statvfs(struct Curl_easy *data, unsigned long sftperr = libssh2_sftp_last_error(sshc->sftp_session); failf(data, "statvfs \"%s\" failed: %s", sshc->quote_path1, sftp_libssh2_strerror(sftperr)); - Curl_safefree(sshc->quote_path1); + curlx_safefree(sshc->quote_path1); myssh_to(data, sshc, SSH_SFTP_CLOSE); sshc->nextstate = SSH_NO_STATE; return CURLE_QUOTE_ERROR; @@ -2290,7 +2290,7 @@ static CURLcode ssh_state_sftp_close(struct Curl_easy *data, sshc->sftp_handle = NULL; } - Curl_safefree(sshp->path); + curlx_safefree(sshp->path); CURL_TRC_SSH(data, "SFTP DONE done"); @@ -2338,7 +2338,7 @@ static CURLcode ssh_state_sftp_shutdown(struct Curl_easy *data, sshc->sftp_session = NULL; } - Curl_safefree(sshc->homedir); + curlx_safefree(sshc->homedir); myssh_to(data, sshc, SSH_SESSION_DISCONNECT); return CURLE_OK; @@ -2451,7 +2451,7 @@ static CURLcode ssh_state_session_disconnect(struct Curl_easy *data, } } - Curl_safefree(sshc->homedir); + curlx_safefree(sshc->homedir); myssh_to(data, sshc, SSH_SESSION_FREE); return CURLE_OK; @@ -2547,11 +2547,11 @@ static CURLcode sshc_cleanup(struct ssh_conn *sshc, struct Curl_easy *data, DEBUGASSERT(sshc->kh == NULL); DEBUGASSERT(sshc->ssh_agent == NULL); - Curl_safefree(sshc->rsa_pub); - Curl_safefree(sshc->rsa); - Curl_safefree(sshc->quote_path1); - Curl_safefree(sshc->quote_path2); - Curl_safefree(sshc->homedir); + curlx_safefree(sshc->rsa_pub); + curlx_safefree(sshc->rsa); + curlx_safefree(sshc->quote_path1); + curlx_safefree(sshc->quote_path2); + curlx_safefree(sshc->homedir); return CURLE_OK; } @@ -3146,7 +3146,7 @@ static void myssh_easy_dtor(void *key, size_t klen, void *entry) struct SSHPROTO *sshp = entry; (void)key; (void)klen; - Curl_safefree(sshp->path); + curlx_safefree(sshp->path); curlx_dyn_free(&sshp->readdir); curlx_dyn_free(&sshp->readdir_link); curlx_free(sshp); diff --git a/lib/vtls/gtls.c b/lib/vtls/gtls.c index b52cc911ff..24ff85e259 100644 --- a/lib/vtls/gtls.c +++ b/lib/vtls/gtls.c @@ -1309,7 +1309,7 @@ static CURLcode pkp_pin_peer_pubkey(struct Curl_easy *data, if(key) gnutls_pubkey_deinit(key); - Curl_safefree(buff1); + curlx_safefree(buff1); return result; } diff --git a/lib/vtls/keylog.c b/lib/vtls/keylog.c index 2b4c5a200c..79f972be12 100644 --- a/lib/vtls/keylog.c +++ b/lib/vtls/keylog.c @@ -52,7 +52,7 @@ void Curl_tls_keylog_open(void) keylog_file_fp = NULL; } } - Curl_safefree(keylog_file_name); + curlx_safefree(keylog_file_name); } } } diff --git a/lib/vtls/mbedtls.c b/lib/vtls/mbedtls.c index 7909467dea..6384ef21f4 100644 --- a/lib/vtls/mbedtls.c +++ b/lib/vtls/mbedtls.c @@ -1360,7 +1360,7 @@ static void mbedtls_close(struct Curl_cfilter *cf, struct Curl_easy *data) #ifdef MBEDTLS_X509_CRL_PARSE_C mbedtls_x509_crl_free(&backend->crl); #endif - Curl_safefree(backend->ciphersuites); + curlx_safefree(backend->ciphersuites); mbedtls_ssl_config_free(&backend->config); mbedtls_ssl_free(&backend->ssl); backend->initialized = FALSE; diff --git a/lib/vtls/openssl.c b/lib/vtls/openssl.c index 2bf870139b..1537d18d95 100644 --- a/lib/vtls/openssl.c +++ b/lib/vtls/openssl.c @@ -1750,7 +1750,7 @@ static void ossl_provider_cleanup(struct Curl_easy *data) } OSSL_LIB_CTX_free(data->state.libctx); data->state.libctx = NULL; - Curl_safefree(data->state.propq); + curlx_safefree(data->state.propq); data->state.provider_loaded = FALSE; } diff --git a/lib/vtls/schannel.c b/lib/vtls/schannel.c index 8290c2a75d..d8af94e59c 100644 --- a/lib/vtls/schannel.c +++ b/lib/vtls/schannel.c @@ -994,7 +994,7 @@ static CURLcode schannel_connect_step1(struct Curl_cfilter *cf, if(sspi_status != SEC_I_CONTINUE_NEEDED) { char buffer[STRERROR_LEN]; - Curl_safefree(backend->ctxt); + curlx_safefree(backend->ctxt); switch(sspi_status) { case SEC_E_INSUFFICIENT_MEMORY: failf(data, "schannel: initial InitializeSecurityContext failed: %s", @@ -1348,7 +1348,7 @@ static CURLcode schannel_connect_step2(struct Curl_cfilter *cf, &outbuf_desc, &backend->ret_flags, NULL); /* free buffer for received handshake data */ - Curl_safefree(inbuf[0].pvBuffer); + curlx_safefree(inbuf[0].pvBuffer); /* check if the handshake was incomplete */ switch(sspi_status) { @@ -1568,7 +1568,7 @@ static void schannel_session_free(void *sessionid) CertCloseStore(cred->client_cert_store, 0); cred->client_cert_store = NULL; } - Curl_safefree(cred); + curlx_safefree(cred); } } } @@ -2082,7 +2082,7 @@ static CURLcode schannel_send(struct Curl_cfilter *cf, struct Curl_easy *data, result = CURLE_SEND_ERROR; } - Curl_safefree(ptr); + curlx_safefree(ptr); if(len == *pnwritten) /* Encrypted message including header, data and trailer entirely sent. @@ -2550,7 +2550,7 @@ static void schannel_close(struct Curl_cfilter *cf, struct Curl_easy *data) if(backend->ctxt) { DEBUGF(infof(data, "schannel: clear security context handle")); Curl_pSecFn->DeleteSecurityContext(&backend->ctxt->ctxt_handle); - Curl_safefree(backend->ctxt); + curlx_safefree(backend->ctxt); } /* free SSPI Schannel API credential handle */ @@ -2563,7 +2563,7 @@ static void schannel_close(struct Curl_cfilter *cf, struct Curl_easy *data) /* free internal buffer for received encrypted data */ if(backend->encdata.buffer) { - Curl_safefree(backend->encdata.buffer); + curlx_safefree(backend->encdata.buffer); backend->encdata.length = 0; backend->encdata.offset = 0; backend->encdata_is_incomplete = FALSE; @@ -2571,7 +2571,7 @@ static void schannel_close(struct Curl_cfilter *cf, struct Curl_easy *data) /* free internal buffer for received decrypted data */ if(backend->decdata.buffer) { - Curl_safefree(backend->decdata.buffer); + curlx_safefree(backend->decdata.buffer); backend->decdata.length = 0; backend->decdata.offset = 0; } diff --git a/lib/vtls/schannel_verify.c b/lib/vtls/schannel_verify.c index 5c5ad9c350..d553f9b15b 100644 --- a/lib/vtls/schannel_verify.c +++ b/lib/vtls/schannel_verify.c @@ -336,7 +336,7 @@ cleanup: if(ca_file_handle != INVALID_HANDLE_VALUE) { CloseHandle(ca_file_handle); } - Curl_safefree(ca_file_buffer); + curlx_safefree(ca_file_buffer); return result; } @@ -650,7 +650,7 @@ CURLcode Curl_verify_host(struct Curl_cfilter *cf, struct Curl_easy *data) cleanup: LocalFree(alt_name_info); - Curl_safefree(cert_hostname_buff); + curlx_safefree(cert_hostname_buff); if(pCertContextServer) CertFreeCertificateContext(pCertContextServer); diff --git a/lib/vtls/vtls.c b/lib/vtls/vtls.c index 0cbbbc0529..d64198659b 100644 --- a/lib/vtls/vtls.c +++ b/lib/vtls/vtls.c @@ -272,22 +272,22 @@ static bool clone_ssl_primary_config(struct ssl_primary_config *source, static void free_primary_ssl_config(struct ssl_primary_config *sslc) { - Curl_safefree(sslc->CApath); - Curl_safefree(sslc->CAfile); - Curl_safefree(sslc->issuercert); - Curl_safefree(sslc->clientcert); - Curl_safefree(sslc->cipher_list); - Curl_safefree(sslc->cipher_list13); - Curl_safefree(sslc->pinned_key); - Curl_safefree(sslc->cert_blob); - Curl_safefree(sslc->ca_info_blob); - Curl_safefree(sslc->issuercert_blob); - Curl_safefree(sslc->curves); - Curl_safefree(sslc->signature_algorithms); - Curl_safefree(sslc->CRLfile); + curlx_safefree(sslc->CApath); + curlx_safefree(sslc->CAfile); + curlx_safefree(sslc->issuercert); + curlx_safefree(sslc->clientcert); + curlx_safefree(sslc->cipher_list); + curlx_safefree(sslc->cipher_list13); + curlx_safefree(sslc->pinned_key); + curlx_safefree(sslc->cert_blob); + curlx_safefree(sslc->ca_info_blob); + curlx_safefree(sslc->issuercert_blob); + curlx_safefree(sslc->curves); + curlx_safefree(sslc->signature_algorithms); + curlx_safefree(sslc->CRLfile); #ifdef USE_TLS_SRP - Curl_safefree(sslc->username); - Curl_safefree(sslc->password); + curlx_safefree(sslc->username); + curlx_safefree(sslc->password); #endif } @@ -520,7 +520,7 @@ static struct ssl_connect_data *cf_ctx_new(struct Curl_easy *data, static void cf_ctx_free(struct ssl_connect_data *ctx) { if(ctx) { - Curl_safefree(ctx->negotiated.alpn); + curlx_safefree(ctx->negotiated.alpn); Curl_bufq_free(&ctx->earlydata); curlx_free(ctx->backend); curlx_free(ctx); @@ -787,7 +787,7 @@ CURLcode Curl_pin_peer_pubkey(struct Curl_easy *data, encode = curlx_base64_encode(sha256sumdigest, CURL_SHA256_DIGEST_LENGTH, &cert_hash, &cert_hash_len); - Curl_safefree(sha256sumdigest); + curlx_safefree(sha256sumdigest); if(encode) return encode; @@ -815,7 +815,7 @@ CURLcode Curl_pin_peer_pubkey(struct Curl_easy *data, /* next one or we are at the end */ pinned_hash = end_pos ? (end_pos + 1) : NULL; } - Curl_safefree(cert_hash); + curlx_safefree(cert_hash); } else { long filesize; @@ -885,7 +885,7 @@ CURLcode Curl_pin_peer_pubkey(struct Curl_easy *data, result = CURLE_OK; end: curlx_dyn_free(&buf); - Curl_safefree(pem_ptr); + curlx_safefree(pem_ptr); curlx_fclose(fp); } @@ -1179,12 +1179,12 @@ CURLsslset Curl_init_sslset_nolock(curl_sslbackend id, const char *name, void Curl_ssl_peer_cleanup(struct ssl_peer *peer) { - Curl_safefree(peer->sni); + curlx_safefree(peer->sni); if(peer->dispname != peer->hostname) curlx_free(peer->dispname); peer->dispname = NULL; - Curl_safefree(peer->hostname); - Curl_safefree(peer->scache_key); + curlx_safefree(peer->hostname); + curlx_safefree(peer->scache_key); peer->type = CURL_SSL_PEER_DNS; } diff --git a/lib/vtls/vtls_scache.c b/lib/vtls/vtls_scache.c index 673abcfe0d..16c68a6145 100644 --- a/lib/vtls/vtls_scache.c +++ b/lib/vtls/vtls_scache.c @@ -401,12 +401,12 @@ static void cf_ssl_scache_clear_peer(struct Curl_ssl_scache_peer *peer) peer->sobj = NULL; } peer->sobj_free = NULL; - Curl_safefree(peer->clientcert); + curlx_safefree(peer->clientcert); #ifdef USE_TLS_SRP - Curl_safefree(peer->srp_username); - Curl_safefree(peer->srp_password); + curlx_safefree(peer->srp_username); + curlx_safefree(peer->srp_password); #endif - Curl_safefree(peer->ssl_peer_key); + curlx_safefree(peer->ssl_peer_key); peer->age = 0; peer->hmac_set = FALSE; } diff --git a/src/tool_cb_hdr.c b/src/tool_cb_hdr.c index c51637a8b0..9b3a33aefb 100644 --- a/src/tool_cb_hdr.c +++ b/src/tool_cb_hdr.c @@ -187,7 +187,7 @@ static char *parse_filename(const char *ptr, size_t len, char stop) if(q) { p = q + 1; if(!*p) { - tool_safefree(copy); + curlx_safefree(copy); return NULL; } } @@ -199,7 +199,7 @@ static char *parse_filename(const char *ptr, size_t len, char stop) if(q) { p = q + 1; if(!*p) { - tool_safefree(copy); + curlx_safefree(copy); return NULL; } } @@ -220,7 +220,7 @@ static char *parse_filename(const char *ptr, size_t len, char stop) { char *sanitized; SANITIZEcode sc = sanitize_file_name(&sanitized, copy, 0); - tool_safefree(copy); + curlx_safefree(copy); if(sc) return NULL; copy = sanitized; @@ -309,7 +309,7 @@ static size_t content_disposition(const char *str, const char *end, return CURL_WRITEFUNC_ERROR; } if(outs->alloc_filename) - tool_safefree(outs->filename); + curlx_safefree(outs->filename); if(per->config->output_dir) { char *f = curl_maprintf("%s/%s", per->config->output_dir, @@ -364,7 +364,7 @@ static size_t content_disposition(const char *str, const char *end, return CURL_WRITEFUNC_ERROR; } if(outs->alloc_filename) - tool_safefree(outs->filename); + curlx_safefree(outs->filename); if(per->config->output_dir) { char *f = curl_maprintf("%s/%s", per->config->output_dir, diff --git a/src/tool_cfgable.c b/src/tool_cfgable.c index 0bfeac6f1f..90cbdcea39 100644 --- a/src/tool_cfgable.c +++ b/src/tool_cfgable.c @@ -61,57 +61,57 @@ static void free_config_fields(struct OperationConfig *config) { struct getout *urlnode; - tool_safefree(config->useragent); - tool_safefree(config->altsvc); - tool_safefree(config->hsts); - tool_safefree(config->haproxy_clientip); + curlx_safefree(config->useragent); + curlx_safefree(config->altsvc); + curlx_safefree(config->hsts); + curlx_safefree(config->haproxy_clientip); curl_slist_free_all(config->cookies); - tool_safefree(config->cookiejar); + curlx_safefree(config->cookiejar); curl_slist_free_all(config->cookiefiles); curlx_dyn_free(&config->postdata); - tool_safefree(config->query); - tool_safefree(config->referer); + curlx_safefree(config->query); + curlx_safefree(config->referer); - tool_safefree(config->headerfile); - tool_safefree(config->ftpport); - tool_safefree(config->iface); + curlx_safefree(config->headerfile); + curlx_safefree(config->ftpport); + curlx_safefree(config->iface); - tool_safefree(config->range); + curlx_safefree(config->range); - tool_safefree(config->userpwd); - tool_safefree(config->tls_username); - tool_safefree(config->tls_password); - tool_safefree(config->tls_authtype); - tool_safefree(config->proxy_tls_username); - tool_safefree(config->proxy_tls_password); - tool_safefree(config->proxy_tls_authtype); - tool_safefree(config->proxyuserpwd); - tool_safefree(config->proxy); + curlx_safefree(config->userpwd); + curlx_safefree(config->tls_username); + curlx_safefree(config->tls_password); + curlx_safefree(config->tls_authtype); + curlx_safefree(config->proxy_tls_username); + curlx_safefree(config->proxy_tls_password); + curlx_safefree(config->proxy_tls_authtype); + curlx_safefree(config->proxyuserpwd); + curlx_safefree(config->proxy); - tool_safefree(config->dns_ipv6_addr); - tool_safefree(config->dns_ipv4_addr); - tool_safefree(config->dns_interface); - tool_safefree(config->dns_servers); + curlx_safefree(config->dns_ipv6_addr); + curlx_safefree(config->dns_ipv4_addr); + curlx_safefree(config->dns_interface); + curlx_safefree(config->dns_servers); - tool_safefree(config->noproxy); + curlx_safefree(config->noproxy); - tool_safefree(config->mail_from); + curlx_safefree(config->mail_from); curl_slist_free_all(config->mail_rcpt); - tool_safefree(config->mail_auth); + curlx_safefree(config->mail_auth); - tool_safefree(config->netrc_file); - tool_safefree(config->output_dir); - tool_safefree(config->proto_str); - tool_safefree(config->proto_redir_str); + curlx_safefree(config->netrc_file); + curlx_safefree(config->output_dir); + curlx_safefree(config->proto_str); + curlx_safefree(config->proto_redir_str); urlnode = config->url_list; while(urlnode) { struct getout *next = urlnode->next; - tool_safefree(urlnode->url); - tool_safefree(urlnode->outfile); - tool_safefree(urlnode->infile); - tool_safefree(urlnode); + curlx_safefree(urlnode->url); + curlx_safefree(urlnode->outfile); + curlx_safefree(urlnode->infile); + curlx_safefree(urlnode); urlnode = next; } config->url_list = NULL; @@ -120,48 +120,48 @@ static void free_config_fields(struct OperationConfig *config) config->url_out = NULL; #ifndef CURL_DISABLE_IPFS - tool_safefree(config->ipfs_gateway); + curlx_safefree(config->ipfs_gateway); #endif - tool_safefree(config->doh_url); - tool_safefree(config->cipher_list); - tool_safefree(config->proxy_cipher_list); - tool_safefree(config->cipher13_list); - tool_safefree(config->proxy_cipher13_list); - tool_safefree(config->cert); - tool_safefree(config->proxy_cert); - tool_safefree(config->cert_type); - tool_safefree(config->proxy_cert_type); - tool_safefree(config->cacert); - tool_safefree(config->login_options); - tool_safefree(config->proxy_cacert); - tool_safefree(config->capath); - tool_safefree(config->proxy_capath); - tool_safefree(config->crlfile); - tool_safefree(config->pinnedpubkey); - tool_safefree(config->proxy_pinnedpubkey); - tool_safefree(config->proxy_crlfile); - tool_safefree(config->key); - tool_safefree(config->proxy_key); - tool_safefree(config->key_type); - tool_safefree(config->proxy_key_type); - tool_safefree(config->key_passwd); - tool_safefree(config->proxy_key_passwd); - tool_safefree(config->pubkey); - tool_safefree(config->hostpubmd5); - tool_safefree(config->hostpubsha256); - tool_safefree(config->engine); - tool_safefree(config->etag_save_file); - tool_safefree(config->etag_compare_file); - tool_safefree(config->ssl_ec_curves); - tool_safefree(config->ssl_signature_algorithms); - tool_safefree(config->request_target); - tool_safefree(config->customrequest); - tool_safefree(config->krblevel); - tool_safefree(config->oauth_bearer); - tool_safefree(config->sasl_authzid); - tool_safefree(config->unix_socket_path); - tool_safefree(config->writeout); - tool_safefree(config->proto_default); + curlx_safefree(config->doh_url); + curlx_safefree(config->cipher_list); + curlx_safefree(config->proxy_cipher_list); + curlx_safefree(config->cipher13_list); + curlx_safefree(config->proxy_cipher13_list); + curlx_safefree(config->cert); + curlx_safefree(config->proxy_cert); + curlx_safefree(config->cert_type); + curlx_safefree(config->proxy_cert_type); + curlx_safefree(config->cacert); + curlx_safefree(config->login_options); + curlx_safefree(config->proxy_cacert); + curlx_safefree(config->capath); + curlx_safefree(config->proxy_capath); + curlx_safefree(config->crlfile); + curlx_safefree(config->pinnedpubkey); + curlx_safefree(config->proxy_pinnedpubkey); + curlx_safefree(config->proxy_crlfile); + curlx_safefree(config->key); + curlx_safefree(config->proxy_key); + curlx_safefree(config->key_type); + curlx_safefree(config->proxy_key_type); + curlx_safefree(config->key_passwd); + curlx_safefree(config->proxy_key_passwd); + curlx_safefree(config->pubkey); + curlx_safefree(config->hostpubmd5); + curlx_safefree(config->hostpubsha256); + curlx_safefree(config->engine); + curlx_safefree(config->etag_save_file); + curlx_safefree(config->etag_compare_file); + curlx_safefree(config->ssl_ec_curves); + curlx_safefree(config->ssl_signature_algorithms); + curlx_safefree(config->request_target); + curlx_safefree(config->customrequest); + curlx_safefree(config->krblevel); + curlx_safefree(config->oauth_bearer); + curlx_safefree(config->sasl_authzid); + curlx_safefree(config->unix_socket_path); + curlx_safefree(config->writeout); + curlx_safefree(config->proto_default); curl_slist_free_all(config->quote); curl_slist_free_all(config->postquote); @@ -180,16 +180,16 @@ static void free_config_fields(struct OperationConfig *config) curl_slist_free_all(config->resolve); curl_slist_free_all(config->connect_to); - tool_safefree(config->preproxy); - tool_safefree(config->proxy_service_name); - tool_safefree(config->service_name); - tool_safefree(config->ftp_account); - tool_safefree(config->ftp_alternative_to_user); - tool_safefree(config->aws_sigv4); - tool_safefree(config->ech); - tool_safefree(config->ech_config); - tool_safefree(config->ech_public); - tool_safefree(config->knownhosts); + curlx_safefree(config->preproxy); + curlx_safefree(config->proxy_service_name); + curlx_safefree(config->service_name); + curlx_safefree(config->ftp_account); + curlx_safefree(config->ftp_alternative_to_user); + curlx_safefree(config->aws_sigv4); + curlx_safefree(config->ech); + curlx_safefree(config->ech_config); + curlx_safefree(config->ech_public); + curlx_safefree(config->knownhosts); } void config_free(struct OperationConfig *config) @@ -355,14 +355,14 @@ CURLcode globalconf_init(void) static void free_globalconfig(void) { - tool_safefree(global->trace_dump); + curlx_safefree(global->trace_dump); if(global->trace_fopened && global->trace_stream) curlx_fclose(global->trace_stream); global->trace_stream = NULL; - tool_safefree(global->ssl_sessions); - tool_safefree(global->libcurl); + curlx_safefree(global->ssl_sessions); + curlx_safefree(global->libcurl); #ifdef _WIN32 curlx_free(global->term.buf); #endif diff --git a/src/tool_cfgable.h b/src/tool_cfgable.h index 53d8eaecb2..cc828b984c 100644 --- a/src/tool_cfgable.h +++ b/src/tool_cfgable.h @@ -33,12 +33,6 @@ #define checkprefix(a, b) curl_strnequal(b, STRCONST(a)) -#define tool_safefree(ptr) \ - do { \ - curlx_free(ptr); \ - (ptr) = NULL; \ - } while(0) - extern struct GlobalConfig *global; struct State { diff --git a/src/tool_formparse.c b/src/tool_formparse.c index 0845e0c0f5..e129452d43 100644 --- a/src/tool_formparse.c +++ b/src/tool_formparse.c @@ -160,7 +160,7 @@ static struct tool_mime *tool_mime_new_filedata(struct tool_mime *parent, } m = tool_mime_new(parent, TOOLMIME_STDIN); if(!m) - tool_safefree(data); + curlx_safefree(data); else { m->data = data; m->origin = origin; @@ -181,11 +181,11 @@ void tool_mime_free(struct tool_mime *mime) tool_mime_free(mime->subparts); if(mime->prev) tool_mime_free(mime->prev); - tool_safefree(mime->name); - tool_safefree(mime->filename); - tool_safefree(mime->type); - tool_safefree(mime->encoder); - tool_safefree(mime->data); + curlx_safefree(mime->name); + curlx_safefree(mime->filename); + curlx_safefree(mime->type); + curlx_safefree(mime->encoder); + curlx_safefree(mime->data); curl_slist_free_all(mime->headers); curlx_free(mime); } @@ -817,7 +817,7 @@ int formparse(const char *input, warnf("error while reading standard input"); goto fail; } - tool_safefree(part->data); + curlx_safefree(part->data); part->size = -1; result = CURLE_OK; } @@ -850,7 +850,7 @@ int formparse(const char *input, warnf("error while reading standard input"); goto fail; } - tool_safefree(part->data); + curlx_safefree(part->data); part->size = -1; result = CURLE_OK; } @@ -891,7 +891,7 @@ int formparse(const char *input, } err = 0; fail: - tool_safefree(contents); + curlx_safefree(contents); curl_slist_free_all(headers); return err; } diff --git a/src/tool_getparam.c b/src/tool_getparam.c index 225defc429..6e1e8ff31d 100644 --- a/src/tool_getparam.c +++ b/src/tool_getparam.c @@ -479,7 +479,7 @@ UNITTEST ParameterError parse_cert_parameter(const char *cert_parameter, } done: if(err) { - tool_safefree(*certname); + curlx_safefree(*certname); } else *certname_place = '\0'; @@ -709,7 +709,7 @@ static ParameterError data_urlencode(const char *nextarg, } else { char *enc = curl_easy_escape(NULL, postdata, (int)size); - tool_safefree(postdata); /* no matter if it worked or not */ + curlx_safefree(postdata); /* no matter if it worked or not */ if(enc) { char *n; replace_url_encoded_space_by_plus(enc); @@ -1005,7 +1005,7 @@ static ParameterError set_data(cmdline_t cmd, if(!err && curlx_dyn_addn(&config->postdata, postdata, size)) err = PARAM_NO_MEM; - tool_safefree(postdata); + curlx_safefree(postdata); config->postfields = curlx_dyn_ptr(&config->postdata); return err; @@ -1600,7 +1600,7 @@ static ParameterError parse_writeout(struct OperationConfig *config, return PARAM_READ_ERROR; } } - tool_safefree(config->writeout); + curlx_safefree(config->writeout); err = file2string(&config->writeout, file); if(file && (file != stdin)) curlx_fclose(file); @@ -1759,7 +1759,7 @@ static ParameterError opt_none(struct OperationConfig *config, case C_DUMP_CA_EMBED: /* --dump-ca-embed */ return PARAM_CA_EMBED_REQUESTED; case C_FTP_PASV: /* --ftp-pasv */ - tool_safefree(config->ftpport); + curlx_safefree(config->ftpport); break; case C_HTTP1_0: /* --http1.0 */ @@ -2390,7 +2390,7 @@ static ParameterError opt_string(struct OperationConfig *config, err = getstr(&config->doh_url, nextarg, ALLOW_BLANK); if(!err && config->doh_url && !config->doh_url[0]) /* if given a blank string, make it NULL again */ - tool_safefree(config->doh_url); + curlx_safefree(config->doh_url); break; case C_CIPHERS: /* -- ciphers */ @@ -2664,7 +2664,7 @@ static ParameterError opt_string(struct OperationConfig *config, if(len) err = getstrn(&config->referer, nextarg, len, ALLOW_BLANK); else - tool_safefree(config->referer); + curlx_safefree(config->referer); } break; case C_CERT_TYPE: /* --cert-type */ diff --git a/src/tool_ipfs.c b/src/tool_ipfs.c index a510a983b2..2abfcfd3db 100644 --- a/src/tool_ipfs.c +++ b/src/tool_ipfs.c @@ -195,7 +195,7 @@ CURLcode ipfs_url_rewrite(CURLU *uh, const char *protocol, char **url, goto clean; /* Free whatever it has now, rewriting is next */ - tool_safefree(*url); + curlx_safefree(*url); if(curl_url_get(uh, CURLUPART_URL, &cloneurl, CURLU_URLENCODE)) { goto clean; diff --git a/src/tool_operate.c b/src/tool_operate.c index 6e07c5e769..143e3d3d42 100644 --- a/src/tool_operate.c +++ b/src/tool_operate.c @@ -325,7 +325,7 @@ void single_transfer_cleanup(void) struct State *state = &global->state; /* Free list of remaining URLs */ glob_cleanup(&state->urlglob); - tool_safefree(state->uploadfile); + curlx_safefree(state->uploadfile); /* Free list of globbed upload files */ glob_cleanup(&state->inglob); } @@ -769,16 +769,16 @@ static CURLcode post_per_transfer(struct per_transfer *per, curlx_fclose(per->heads.stream); if(per->heads.alloc_filename) - tool_safefree(per->heads.filename); + curlx_safefree(per->heads.filename); if(per->etag_save.fopened && per->etag_save.stream) curlx_fclose(per->etag_save.stream); if(per->etag_save.alloc_filename) - tool_safefree(per->etag_save.filename); + curlx_safefree(per->etag_save.filename); if(outs->alloc_filename) - tool_safefree(outs->filename); + curlx_safefree(outs->filename); curl_slist_free_all(per->hdrcbdata.headlist); per->hdrcbdata.headlist = NULL; return result; @@ -882,7 +882,7 @@ static CURLcode etag_compare(struct OperationConfig *config) if((PARAM_OK == file2string(&etag_from_file, file)) && etag_from_file) { char *h = curl_maprintf("If-None-Match: %s", etag_from_file); - tool_safefree(etag_from_file); + curlx_safefree(etag_from_file); if(h) { /* move it to the right memory */ header = curlx_strdup(h); @@ -1030,7 +1030,7 @@ static CURLcode setup_outfile(struct OperationConfig *config, SANITIZEcode sc; CURLcode result = glob_match_url(&per->outfile, storefile, &state->urlglob, &sc); - tool_safefree(storefile); + curlx_safefree(storefile); if(sc) { if(sc == SANITIZE_ERR_OUT_OF_MEMORY) return CURLE_OUT_OF_MEMORY; @@ -1052,7 +1052,7 @@ static CURLcode setup_outfile(struct OperationConfig *config, if(config->output_dir && *config->output_dir) { char *d = curl_maprintf("%s/%s", config->output_dir, per->outfile); - tool_safefree(per->outfile); + curlx_safefree(per->outfile); if(d) { per->outfile = curlx_strdup(d); /* move to right memory */ curl_free(d); @@ -1233,7 +1233,7 @@ static CURLcode create_single(struct OperationConfig *config, if(state->upidx >= state->upnum) { state->urlnum = 0; - tool_safefree(state->uploadfile); + curlx_safefree(state->uploadfile); glob_cleanup(&state->inglob); state->upidx = 0; state->urlnode = u->next; /* next node */ @@ -1286,7 +1286,7 @@ static CURLcode create_single(struct OperationConfig *config, per->uploadfile = curlx_strdup(state->uploadfile); if(!per->uploadfile || SetHTTPrequest(TOOL_HTTPREQ_PUT, &config->httpreq)) { - tool_safefree(per->uploadfile); + curlx_safefree(per->uploadfile); curl_easy_cleanup(curl); return CURLE_FAILED_INIT; } @@ -1404,7 +1404,7 @@ static CURLcode create_single(struct OperationConfig *config, state->urlidx = state->urlnum = 0; glob_cleanup(&state->urlglob); state->upidx++; - tool_safefree(state->uploadfile); /* clear it to get the next */ + curlx_safefree(state->uploadfile); /* clear it to get the next */ } *added = TRUE; break; @@ -2155,7 +2155,7 @@ static CURLcode cacertpaths(struct OperationConfig *config) #endif return CURLE_OK; fail: - Curl_safefree(config->capath); + curlx_safefree(config->capath); return result; } diff --git a/src/tool_operhlp.c b/src/tool_operhlp.c index 0277657526..0e360cbcbd 100644 --- a/src/tool_operhlp.c +++ b/src/tool_operhlp.c @@ -37,10 +37,10 @@ void clean_getout(struct OperationConfig *config) while(node) { next = node->next; - tool_safefree(node->url); - tool_safefree(node->outfile); - tool_safefree(node->infile); - tool_safefree(node); + curlx_safefree(node->url); + curlx_safefree(node->outfile); + curlx_safefree(node->infile); + curlx_safefree(node); node = next; } config->url_list = NULL; @@ -230,7 +230,7 @@ CURLcode get_url_file_name(char **filename, const char *url, SANITIZEcode *sc) { char *sanitized; *sc = sanitize_file_name(&sanitized, *filename, 0); - tool_safefree(*filename); + curlx_safefree(*filename); if(*sc) return CURLE_BAD_FUNCTION_ARGUMENT; *filename = sanitized; diff --git a/src/tool_ssls.c b/src/tool_ssls.c index 22f2571126..a492d8e1e3 100644 --- a/src/tool_ssls.c +++ b/src/tool_ssls.c @@ -79,8 +79,8 @@ CURLcode tool_ssls_load(struct OperationConfig *config, i = imported = 0; while(my_get_line(fp, &buf, &error)) { ++i; - tool_safefree(shmac); - tool_safefree(sdata); + curlx_safefree(shmac); + curlx_safefree(sdata); line = curlx_dyn_ptr(&buf); c = memchr(line, ':', strlen(line)); @@ -165,7 +165,7 @@ static CURLcode tool_ssls_exp(CURL *easy, void *userptr, goto out; if(EOF == fputc(':', ctx->fp)) goto out; - tool_safefree(enc); + curlx_safefree(enc); result = curlx_base64_encode(sdata, sdata_len, &enc, &enc_len); if(result) goto out; diff --git a/src/tool_urlglob.c b/src/tool_urlglob.c index d32d10d167..ad1c8087da 100644 --- a/src/tool_urlglob.c +++ b/src/tool_urlglob.c @@ -50,7 +50,7 @@ static CURLcode glob_fixed(struct URLGlob *glob, char *fixed, size_t len) pat->c.set.elem[0] = curlx_memdup0(fixed, len); if(!pat->c.set.elem[0]) { - tool_safefree(pat->c.set.elem); + curlx_safefree(pat->c.set.elem); return globerror(glob, NULL, 0, CURLE_OUT_OF_MEMORY); } @@ -204,7 +204,7 @@ error: { size_t i; for(i = 0; i < size; i++) - tool_safefree(elem[i]); + curlx_safefree(elem[i]); } curlx_free(elem); return result; @@ -542,11 +542,11 @@ void glob_cleanup(struct URLGlob *glob) (glob->pattern[i].c.set.elem)) { curl_off_t elem; for(elem = 0; elem < glob->pattern[i].c.set.size; elem++) - tool_safefree(glob->pattern[i].c.set.elem[elem]); - tool_safefree(glob->pattern[i].c.set.elem); + curlx_safefree(glob->pattern[i].c.set.elem[elem]); + curlx_safefree(glob->pattern[i].c.set.elem); } } - tool_safefree(glob->pattern); + curlx_safefree(glob->pattern); glob->palloc = 0; curlx_dyn_free(&glob->buf); } diff --git a/tests/libtest/lib558.c b/tests/libtest/lib558.c index b586e8d317..6a14719bb5 100644 --- a/tests/libtest/lib558.c +++ b/tests/libtest/lib558.c @@ -39,7 +39,7 @@ static CURLcode test_lib558(const char *URL) } ptr = curlx_malloc(558); - Curl_safefree(ptr); + curlx_safefree(ptr); asize = (int)sizeof(a); ptr = curl_easy_escape(NULL, (char *)a, asize); diff --git a/tests/unit/unit1302.c b/tests/unit/unit1302.c index 32f77f1926..c96f055273 100644 --- a/tests/unit/unit1302.c +++ b/tests/unit/unit1302.c @@ -24,7 +24,7 @@ #include "unitcheck.h" #include "urldata.h" -#include "url.h" /* for Curl_safefree */ +#include "url.h" /* for curlx_safefree */ struct etest { const char *input; @@ -140,7 +140,7 @@ static CURLcode test_unit1302(const char *arg) curl_mfprintf(stderr, "Test %u encoded badly\n", i); unitfail++; } - Curl_safefree(out); + curlx_safefree(out); /* then verify decode */ result = curlx_base64_decode(e->output, &decoded, &dlen); @@ -160,7 +160,7 @@ static CURLcode test_unit1302(const char *arg) unitfail++; } - Curl_safefree(decoded); + curlx_safefree(decoded); } for(i = 0; i < CURL_ARRAYSIZE(url); i++) { @@ -179,7 +179,7 @@ static CURLcode test_unit1302(const char *arg) "expected '%s'\n", i, out, e->output); unitfail++; } - Curl_safefree(out); + curlx_safefree(out); } for(i = 0; i < CURL_ARRAYSIZE(badecode); i++) { diff --git a/tests/unit/unit1304.c b/tests/unit/unit1304.c index 231ddd45f8..e0e3d60501 100644 --- a/tests/unit/unit1304.c +++ b/tests/unit/unit1304.c @@ -29,8 +29,8 @@ static void t1304_stop(char **password, char **login) { - Curl_safefree(*password); - Curl_safefree(*login); + curlx_safefree(*password); + curlx_safefree(*login); } static CURLcode test_unit1304(const char *arg) diff --git a/tests/unit/unit1330.c b/tests/unit/unit1330.c index a98393b532..79df0e58df 100644 --- a/tests/unit/unit1330.c +++ b/tests/unit/unit1330.c @@ -28,7 +28,7 @@ static CURLcode test_unit1330(const char *arg) UNITTEST_BEGIN_SIMPLE char *ptr = curlx_malloc(1330); - Curl_safefree(ptr); + curlx_safefree(ptr); UNITTEST_END_SIMPLE } diff --git a/tests/unit/unit1653.c b/tests/unit/unit1653.c index 2cd8f0f6c1..863845a2b0 100644 --- a/tests/unit/unit1653.c +++ b/tests/unit/unit1653.c @@ -59,7 +59,7 @@ static CURLcode test_unit1653(const char *arg) fail_unless(ret == CURLUE_OK, "parse_port returned error"); ret = curl_url_get(u, CURLUPART_PORT, &portnum, CURLU_NO_DEFAULT_PORT); fail_unless(ret != CURLUE_OK, "curl_url_get portnum returned something"); - Curl_safefree(ipv6port); + curlx_safefree(ipv6port); curl_url_cleanup(u); /* Invalid IPv6 */ @@ -71,7 +71,7 @@ static CURLcode test_unit1653(const char *arg) goto fail; ret = parse_port(u, ipv6port, FALSE); fail_unless(ret != CURLUE_OK, "parse_port true on error"); - Curl_safefree(ipv6port); + curlx_safefree(ipv6port); curl_url_cleanup(u); u = curl_url(); @@ -87,7 +87,7 @@ static CURLcode test_unit1653(const char *arg) fail_unless(portnum && !strcmp(portnum, "808"), "Check portnumber"); curl_free(portnum); - Curl_safefree(ipv6port); + curlx_safefree(ipv6port); curl_url_cleanup(u); /* Valid IPv6 with zone index and port number */ @@ -103,7 +103,7 @@ static CURLcode test_unit1653(const char *arg) fail_unless(ret == CURLUE_OK, "curl_url_get portnum returned error"); fail_unless(portnum && !strcmp(portnum, "80"), "Check portnumber"); curl_free(portnum); - Curl_safefree(ipv6port); + curlx_safefree(ipv6port); curl_url_cleanup(u); /* Valid IPv6 with zone index without port number */ @@ -115,7 +115,7 @@ static CURLcode test_unit1653(const char *arg) goto fail; ret = parse_port(u, ipv6port, FALSE); fail_unless(ret == CURLUE_OK, "parse_port returned error"); - Curl_safefree(ipv6port); + curlx_safefree(ipv6port); curl_url_cleanup(u); /* Valid IPv6 with port number */ @@ -131,7 +131,7 @@ static CURLcode test_unit1653(const char *arg) fail_unless(ret == CURLUE_OK, "curl_url_get portnum returned error"); fail_unless(portnum && !strcmp(portnum, "81"), "Check portnumber"); curl_free(portnum); - Curl_safefree(ipv6port); + curlx_safefree(ipv6port); curl_url_cleanup(u); /* Valid IPv6 with syntax error in the port number */ @@ -143,7 +143,7 @@ static CURLcode test_unit1653(const char *arg) goto fail; ret = parse_port(u, ipv6port, FALSE); fail_unless(ret != CURLUE_OK, "parse_port true on error"); - Curl_safefree(ipv6port); + curlx_safefree(ipv6port); curl_url_cleanup(u); u = curl_url(); @@ -154,7 +154,7 @@ static CURLcode test_unit1653(const char *arg) goto fail; ret = parse_port(u, ipv6port, FALSE); fail_unless(ret != CURLUE_OK, "parse_port true on error"); - Curl_safefree(ipv6port); + curlx_safefree(ipv6port); curl_url_cleanup(u); /* Valid IPv6 with no port after the colon, should use default if a scheme @@ -167,7 +167,7 @@ static CURLcode test_unit1653(const char *arg) goto fail; ret = parse_port(u, ipv6port, TRUE); fail_unless(ret == CURLUE_OK, "parse_port returned error"); - Curl_safefree(ipv6port); + curlx_safefree(ipv6port); curl_url_cleanup(u); /* Incorrect zone index syntax, but the port extractor does not care */ @@ -183,7 +183,7 @@ static CURLcode test_unit1653(const char *arg) fail_unless(ret == CURLUE_OK, "curl_url_get portnum returned error"); fail_unless(portnum && !strcmp(portnum, "180"), "Check portnumber"); curl_free(portnum); - Curl_safefree(ipv6port); + curlx_safefree(ipv6port); curl_url_cleanup(u); /* Non percent-encoded zone index */ @@ -195,7 +195,7 @@ static CURLcode test_unit1653(const char *arg) goto fail; ret = parse_port(u, ipv6port, FALSE); fail_unless(ret == CURLUE_OK, "parse_port returned error"); - Curl_safefree(ipv6port); + curlx_safefree(ipv6port); curl_url_cleanup(u); /* No scheme and no digits following the colon - not accepted. Because that