tidy-up: drop stray casts for allocated pointers

Closes #21865
This commit is contained in:
Viktor Szakats 2026-06-05 01:23:06 +02:00
parent cb307544ad
commit 1b8f4dba28
No known key found for this signature in database
16 changed files with 22 additions and 32 deletions

View file

@ -89,7 +89,7 @@ static voidpf zalloc_cb(voidpf opaque, unsigned int items, unsigned int size)
{
(void)opaque;
/* not a typo, keep it curlx_calloc() */
return (voidpf)curlx_calloc(items, size);
return curlx_calloc(items, size);
}
static void zfree_cb(voidpf opaque, voidpf ptr)

View file

@ -1202,9 +1202,7 @@ CURLcode Curl_mime_duppart(struct Curl_easy *data,
/* Create a mime handle. */
curl_mime *curl_mime_init(void *easy)
{
curl_mime *mime;
mime = (curl_mime *)curlx_malloc(sizeof(*mime));
curl_mime *mime = curlx_malloc(sizeof(*mime));
if(mime) {
mime->parent = NULL;
@ -1241,7 +1239,7 @@ curl_mimepart *curl_mime_addpart(curl_mime *mime)
if(!mime)
return NULL;
part = (curl_mimepart *)curlx_malloc(sizeof(*part));
part = curlx_malloc(sizeof(*part));
if(part) {
Curl_mime_initpart(part);

View file

@ -1938,8 +1938,8 @@ static CURLcode cf_progress_ingress(struct Curl_cfilter *cf,
}
if(ctx->tunnel_inbuf_len < max_udp_payload) {
unsigned char *newbuf =
(unsigned char *)curlx_realloc(ctx->tunnel_inbuf, max_udp_payload);
unsigned char *newbuf = curlx_realloc(ctx->tunnel_inbuf,
max_udp_payload);
if(!newbuf)
return CURLE_OUT_OF_MEMORY;
ctx->tunnel_inbuf = newbuf;

View file

@ -468,7 +468,7 @@ static CURLcode get_client_cert(struct Curl_easy *data,
if(data->set.ssl.primary.key_passwd)
pwd_len = strlen(data->set.ssl.primary.key_passwd);
pszPassword = (WCHAR *)curlx_malloc(sizeof(WCHAR) * (pwd_len + 1));
pszPassword = curlx_malloc(sizeof(WCHAR) * (pwd_len + 1));
if(pszPassword) {
int str_w_len = 0;
if(pwd_len > 0)
@ -2001,7 +2001,7 @@ static CURLcode schannel_send(struct Curl_cfilter *cf, struct Curl_easy *data,
/* calculate the complete message length and allocate a buffer for it */
data_len = backend->stream_sizes.cbHeader + len +
backend->stream_sizes.cbTrailer;
ptr = (unsigned char *)curlx_malloc(data_len);
ptr = curlx_malloc(data_len);
if(!ptr) {
return CURLE_OUT_OF_MEMORY;
}

View file

@ -295,7 +295,7 @@ static CURLcode add_certs_file_to_store(HCERTSTORE trust_store,
goto cleanup;
}
ca_file_buffer = (char *)curlx_malloc(ca_file_bufsize + 1);
ca_file_buffer = curlx_malloc(ca_file_bufsize + 1);
if(!ca_file_buffer) {
result = CURLE_OUT_OF_MEMORY;
goto cleanup;
@ -568,7 +568,7 @@ CURLcode Curl_verify_host(struct Curl_cfilter *cf, struct Curl_easy *data)
/* CertGetNameString guarantees that the returned name does not contain
* embedded null bytes. This appears to be undocumented behavior.
*/
cert_hostname_buff = (LPTSTR)curlx_malloc(len * sizeof(TCHAR));
cert_hostname_buff = curlx_malloc(len * sizeof(TCHAR));
if(!cert_hostname_buff) {
result = CURLE_OUT_OF_MEMORY;
goto cleanup;