curlx: limit use of system allocators to the minimum possible
No binary (build failed)
—
(log yok)
| @@ -132,7 +132,7 @@ CURLcode Curl_create_sspi_identity(const char *userp, const char *passwdp, | |
| /* Setup the identity's user and length */ | |
| dup_user.tchar_ptr = curlx_tcsdup(user.tchar_ptr); | |
| if(!dup_user.tchar_ptr) { | |
| - | curlx_unicodefree(useranddomain.tchar_ptr); |
| + | curlx_free(useranddomain.tchar_ptr); |
| return CURLE_OUT_OF_MEMORY; | |
| } | |
| identity->User = dup_user.tbyte_ptr; | |
| @@ -142,19 +142,19 @@ CURLcode Curl_create_sspi_identity(const char *userp, const char *passwdp, | |
| /* Setup the identity's domain and length */ | |
| dup_domain.tchar_ptr = curlx_malloc(sizeof(TCHAR) * (domlen + 1)); | |
| if(!dup_domain.tchar_ptr) { | |
| - | curlx_unicodefree(useranddomain.tchar_ptr); |
| + | curlx_free(useranddomain.tchar_ptr); |
| return CURLE_OUT_OF_MEMORY; | |
| } | |
| if(_tcsncpy_s(dup_domain.tchar_ptr, domlen + 1, domain.tchar_ptr, domlen)) { | |
| - | curlx_unicodefree(dup_domain.tchar_ptr); |
| - | curlx_unicodefree(useranddomain.tchar_ptr); |
| + | curlx_free(dup_domain.tchar_ptr); |
| + | curlx_free(useranddomain.tchar_ptr); |
| return CURLE_OUT_OF_MEMORY; | |
| } | |
| identity->Domain = dup_domain.tbyte_ptr; | |
| identity->DomainLength = curlx_uztoul(domlen); | |
| dup_domain.tchar_ptr = NULL; | |
| - | curlx_unicodefree(useranddomain.tchar_ptr); |
| + | curlx_free(useranddomain.tchar_ptr); |
| /* Setup the identity's password and length */ | |
| passwd.tchar_ptr = curlx_convert_UTF8_to_tchar(passwdp); | |
| @@ -162,14 +162,14 @@ CURLcode Curl_create_sspi_identity(const char *userp, const char *passwdp, | |
| return CURLE_OUT_OF_MEMORY; | |
| dup_passwd.tchar_ptr = curlx_tcsdup(passwd.tchar_ptr); | |
| if(!dup_passwd.tchar_ptr) { | |
| - | curlx_unicodefree(passwd.tchar_ptr); |
| + | curlx_free(passwd.tchar_ptr); |
| return CURLE_OUT_OF_MEMORY; | |
| } | |
| identity->Password = dup_passwd.tbyte_ptr; | |
| identity->PasswordLength = curlx_uztoul(_tcslen(dup_passwd.tchar_ptr)); | |
| dup_passwd.tchar_ptr = NULL; | |
| - | curlx_unicodefree(passwd.tchar_ptr); |
| + | curlx_free(passwd.tchar_ptr); |
| /* Setup the identity's flags */ | |
| identity->Flags = (unsigned long) | |
| @@ -52,7 +52,6 @@ | |
| curlx_convert_wchar_to_UTF8() | |
| curlx_convert_UTF8_to_tchar() | |
| curlx_convert_tchar_to_UTF8() | |
| - | curlx_unicodefree() |
| */ | |
| #include "version_win32.h" | |
| @@ -22,11 +22,6 @@ | |
| * | |
| ***************************************************************************/ | |
| - | /* |
| - | * Use system allocators to avoid infinite recursion when called by curl's |
| - | * memory tracker memdebug functions. |
| - | */ |
| - | |
| #include "../curl_setup.h" | |
| #include "fopen.h" | |
| @@ -46,10 +41,43 @@ int curlx_fseek(void *stream, curl_off_t offset, int whence) | |
| #ifdef _WIN32 | |
| - | #include "multibyte.h" |
| - | |
| #include <share.h> /* for _SH_DENYNO */ | |
| + | #ifdef CURLDEBUG |
| + | /* |
| + | * Use system allocators to avoid infinite recursion when called by curl's |
| + | * memory tracker memdebug functions. |
| + | */ |
| + | #define CURLX_MALLOC(x) malloc(x) |
| + | #define CURLX_FREE(x) free(x) |
| + | #else |
| + | #define CURLX_MALLOC(x) curlx_malloc(x) |
| + | #define CURLX_FREE(x) curlx_free(x) |
| + | #endif |
| + | |
| + | #ifdef _UNICODE |
| + | static wchar_t *fn_convert_UTF8_to_wchar(const char *str_utf8) |
| + | { |
| + | wchar_t *str_w = NULL; |
| + | |
| + | if(str_utf8) { |
| + | int str_w_len = MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, |
| + | str_utf8, -1, NULL, 0); |
| + | if(str_w_len > 0) { |
| + | str_w = CURLX_MALLOC(str_w_len * sizeof(wchar_t)); |
| + | if(str_w) { |
| + | if(MultiByteToWideChar(CP_UTF8, 0, |
| + | str_utf8, -1, str_w, str_w_len) == 0) { |
| + | CURLX_FREE(str_w); |
| + | return NULL; |
| + | } |
| + | } |
| + | } |
| + | } |
| + | return str_w; |
| + | } |
| + | #endif |
| + | |
| /* declare GetFullPathNameW for mingw-w64 UWP builds targeting old windows */ | |
| #if defined(CURL_WINDOWS_UWP) && defined(__MINGW32__) && \ | |
| (_WIN32_WINNT < _WIN32_WINNT_WIN10) | |
| @@ -228,7 +256,7 @@ int curlx_win32_open(const char *filename, int oflag, ...) | |
| const TCHAR *target = NULL; | |
| #ifdef _UNICODE | |
| - | wchar_t *filename_w = curlx_convert_UTF8_to_wchar(filename); |
| + | wchar_t *filename_w = fn_convert_UTF8_to_wchar(filename); |
| #endif | |
| va_list param; | |
| @@ -244,7 +272,7 @@ int curlx_win32_open(const char *filename, int oflag, ...) | |
| else | |
| target = filename_w; | |
| errno = _wsopen_s(&result, target, oflag, _SH_DENYNO, pmode); | |
| - | curlx_unicodefree(filename_w); |
| + | CURLX_FREE(filename_w); |
| } | |
| else | |
| /* !checksrc! disable ERRNOVAR 1 */ | |
| @@ -268,8 +296,8 @@ FILE *curlx_win32_fopen(const char *filename, const char *mode) | |
| const TCHAR *target = NULL; | |
| #ifdef _UNICODE | |
| - | wchar_t *filename_w = curlx_convert_UTF8_to_wchar(filename); |
| - | wchar_t *mode_w = curlx_convert_UTF8_to_wchar(mode); |
| + | wchar_t *filename_w = fn_convert_UTF8_to_wchar(filename); |
| + | wchar_t *mode_w = fn_convert_UTF8_to_wchar(mode); |
| if(filename_w && mode_w) { | |
| if(fix_excessive_path(filename_w, &fixed)) | |
| target = fixed; | |
| @@ -280,8 +308,8 @@ FILE *curlx_win32_fopen(const char *filename, const char *mode) | |
| else | |
| /* !checksrc! disable ERRNOVAR 1 */ | |
| errno = EINVAL; | |
| - | curlx_unicodefree(filename_w); |
| - | curlx_unicodefree(mode_w); |
| + | CURLX_FREE(filename_w); |
| + | CURLX_FREE(mode_w); |
| #else | |
| if(fix_excessive_path(filename, &fixed)) | |
| target = fixed; | |
| @@ -306,8 +334,8 @@ FILE *curlx_win32_freopen(const char *filename, const char *mode, FILE *fp) | |
| const TCHAR *target = NULL; | |
| #ifdef _UNICODE | |
| - | wchar_t *filename_w = curlx_convert_UTF8_to_wchar(filename); |
| - | wchar_t *mode_w = curlx_convert_UTF8_to_wchar(mode); |
| + | wchar_t *filename_w = fn_convert_UTF8_to_wchar(filename); |
| + | wchar_t *mode_w = fn_convert_UTF8_to_wchar(mode); |
| if(filename_w && mode_w) { | |
| if(fix_excessive_path(filename_w, &fixed)) | |
| target = fixed; | |
| @@ -318,8 +346,8 @@ FILE *curlx_win32_freopen(const char *filename, const char *mode, FILE *fp) | |
| else | |
| /* !checksrc! disable ERRNOVAR 1 */ | |
| errno = EINVAL; | |
| - | curlx_unicodefree(filename_w); |
| - | curlx_unicodefree(mode_w); |
| + | CURLX_FREE(filename_w); |
| + | CURLX_FREE(mode_w); |
| #else | |
| if(fix_excessive_path(filename, &fixed)) | |
| target = fixed; | |
| @@ -339,7 +367,7 @@ int curlx_win32_stat(const char *path, struct_stat *buffer) | |
| const TCHAR *target = NULL; | |
| #ifdef _UNICODE | |
| - | wchar_t *path_w = curlx_convert_UTF8_to_wchar(path); |
| + | wchar_t *path_w = fn_convert_UTF8_to_wchar(path); |
| if(path_w) { | |
| if(fix_excessive_path(path_w, &fixed)) | |
| target = fixed; | |
| @@ -350,7 +378,7 @@ int curlx_win32_stat(const char *path, struct_stat *buffer) | |
| #else | |
| result = _wstati64(target, buffer); | |
| #endif | |
| - | curlx_unicodefree(path_w); |
| + | CURLX_FREE(path_w); |
| } | |
| else | |
| /* !checksrc! disable ERRNOVAR 1 */ | |
| @@ -371,4 +399,7 @@ int curlx_win32_stat(const char *path, struct_stat *buffer) | |
| return result; | |
| } | |
| + | #undef CURLX_MALLOC |
| + | #undef CURLX_FREE |
| + | |
| #endif /* _WIN32 */ | |
| @@ -22,11 +22,6 @@ | |
| * | |
| ***************************************************************************/ | |
| - | /* |
| - | * Use system allocators to avoid infinite recursion when called by curl's |
| - | * memory tracker memdebug functions. |
| - | */ |
| - | |
| #include "../curl_setup.h" | |
| #if defined(_WIN32) && defined(UNICODE) | |
| @@ -45,11 +40,11 @@ wchar_t *curlx_convert_UTF8_to_wchar(const char *str_utf8) | |
| int str_w_len = MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, | |
| str_utf8, -1, NULL, 0); | |
| if(str_w_len > 0) { | |
| - | str_w = CURLX_MALLOC(str_w_len * sizeof(wchar_t)); |
| + | str_w = curlx_malloc(str_w_len * sizeof(wchar_t)); |
| if(str_w) { | |
| if(MultiByteToWideChar(CP_UTF8, 0, str_utf8, -1, str_w, | |
| str_w_len) == 0) { | |
| - | CURLX_FREE(str_w); |
| + | curlx_free(str_w); |
| return NULL; | |
| } | |
| } | |
| @@ -67,11 +62,11 @@ char *curlx_convert_wchar_to_UTF8(const wchar_t *str_w) | |
| int bytes = WideCharToMultiByte(CP_UTF8, 0, str_w, -1, | |
| NULL, 0, NULL, NULL); | |
| if(bytes > 0) { | |
| - | str_utf8 = CURLX_MALLOC(bytes); |
| + | str_utf8 = curlx_malloc(bytes); |
| if(str_utf8) { | |
| if(WideCharToMultiByte(CP_UTF8, 0, str_w, -1, str_utf8, bytes, | |
| NULL, NULL) == 0) { | |
| - | CURLX_FREE(str_utf8); |
| + | curlx_free(str_utf8); |
| return NULL; | |
| } | |
| } | |
| @@ -29,32 +29,16 @@ | |
| /* | |
| * Macros curlx_convert_UTF8_to_tchar(), curlx_convert_tchar_to_UTF8() | |
| - | * and curlx_unicodefree() main purpose is to minimize the number of |
| - | * preprocessor conditional directives needed by code using these |
| - | * to differentiate Unicode from non-Unicode builds. |
| + | * main purpose is to minimize the number of preprocessor conditional |
| + | * directives needed by code using these to differentiate Unicode from |
| + | * non-Unicode builds. |
| * | |
| * In the case of a non-Unicode build the tchar strings are char strings that | |
| * are duplicated via strdup and remain in whatever the passed in encoding is, | |
| * which is assumed to be UTF-8 but may be other encoding. Therefore the | |
| * significance of the conversion functions is primarily for Unicode builds. | |
| - | * |
| - | * Allocated memory should be free'd with curlx_unicodefree(). |
| - | * |
| - | * Use system allocators to avoid infinite recursion when called by curl's |
| - | * memory tracker memdebug functions. |
| */ | |
| - | #ifdef CURLDEBUG |
| - | #define CURLX_MALLOC(x) malloc(x) |
| - | #define CURLX_FREE(x) free(x) |
| - | #else |
| - | #define CURLX_MALLOC(x) curlx_malloc(x) |
| - | #define CURLX_FREE(x) curlx_free(x) |
| - | #endif |
| - | |
| - | /* the purpose of this macro is to free() without being traced by memdebug */ |
| - | #define curlx_unicodefree(ptr) CURLX_FREE(ptr) |
| - | |
| #ifdef UNICODE | |
| /* MultiByte conversions using Windows kernel32 library. */ | |
| @@ -73,13 +57,8 @@ typedef union { | |
| #else /* !UNICODE */ | |
| - | #ifdef CURLDEBUG |
| - | #define curlx_convert_UTF8_to_tchar(ptr) _strdup(ptr) |
| - | #define curlx_convert_tchar_to_UTF8(ptr) _strdup(ptr) |
| - | #else |
| #define curlx_convert_UTF8_to_tchar(ptr) curlx_strdup(ptr) | |
| #define curlx_convert_tchar_to_UTF8(ptr) curlx_strdup(ptr) | |
| - | #endif |
| typedef union { | |
| char *tchar_ptr; | |
| @@ -96,7 +96,7 @@ | |
| #include "connect.h" | |
| #ifdef USE_WIN32_LDAP | |
| - | #define FREE_ON_WINLDAP(x) curlx_unicodefree(x) |
| + | #define FREE_ON_WINLDAP(x) curlx_free(x) |
| #define curl_ldap_num_t ULONG | |
| #else | |
| #define FREE_ON_WINLDAP(x) | |
| @@ -296,8 +296,8 @@ static ULONG ldap_win_bind(struct Curl_easy *data, LDAP *server, | |
| rc = ldap_simple_bind_s(server, inuser, inpass); | |
| - | curlx_unicodefree(inuser); |
| - | curlx_unicodefree(inpass); |
| + | curlx_free(inuser); |
| + | curlx_free(inpass); |
| } | |
| #ifdef USE_WINDOWS_SSPI | |
| else { | |
| @@ -1000,22 +1000,13 @@ static void ldap_free_urldesc_low(LDAPURLDesc *ludp) | |
| if(!ludp) | |
| return; | |
| - | #ifdef USE_WIN32_LDAP |
| - | curlx_unicodefree(ludp->lud_dn); |
| - | curlx_unicodefree(ludp->lud_filter); |
| - | #else |
| curlx_free(ludp->lud_dn); | |
| curlx_free(ludp->lud_filter); | |
| - | #endif |
| if(ludp->lud_attrs) { | |
| size_t i; | |
| for(i = 0; i < ludp->lud_attrs_dups; i++) { | |
| - | #ifdef USE_WIN32_LDAP |
| - | curlx_unicodefree(ludp->lud_attrs[i]); |
| - | #else |
| curlx_free(ludp->lud_attrs[i]); | |
| - | #endif |
| } | |
| curlx_free(ludp->lud_attrs); | |
| } | |
| @@ -46,14 +46,14 @@ int Curl_rename(const char *oldpath, const char *newpath) | |
| for(;;) { | |
| timediff_t diff; | |
| if(MoveFileEx(tchar_oldpath, tchar_newpath, MOVEFILE_REPLACE_EXISTING)) { | |
| - | curlx_unicodefree(tchar_oldpath); |
| - | curlx_unicodefree(tchar_newpath); |
| + | curlx_free(tchar_oldpath); |
| + | curlx_free(tchar_newpath); |
| break; | |
| } | |
| diff = curlx_timediff_ms(curlx_now(), start); | |
| if(diff < 0 || diff > max_wait_ms) { | |
| - | curlx_unicodefree(tchar_oldpath); |
| - | curlx_unicodefree(tchar_newpath); |
| + | curlx_free(tchar_oldpath); |
| + | curlx_free(tchar_newpath); |
| return 1; | |
| } | |
| Sleep(1); | |
| @@ -175,7 +175,7 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(struct Curl_cfilter *cf, | |
| &output_desc, | |
| &sspi_ret_flags, NULL); | |
| - | curlx_unicodefree(sname); |
| + | curlx_free(sname); |
| Curl_safefree(sspi_recv_token.pvBuffer); | |
| sspi_recv_token.cbBuffer = 0; | |
| @@ -298,7 +298,7 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(struct Curl_cfilter *cf, | |
| char *user_utf8 = curlx_convert_tchar_to_UTF8(names.sUserName); | |
| infof(data, "SOCKS5 server authenticated user %s with GSS-API.", | |
| (user_utf8 ? user_utf8 : "(unknown)")); | |
| - | curlx_unicodefree(user_utf8); |
| + | curlx_free(user_utf8); |
| #endif | |
| Curl_pSecFn->FreeContextBuffer(names.sUserName); | |
| names.sUserName = NULL; | |
| @@ -273,7 +273,7 @@ CURLcode Curl_override_sspi_http_realm(const char *chlg, | |
| dup_domain.tchar_ptr = curlx_tcsdup(domain.tchar_ptr); | |
| if(!dup_domain.tchar_ptr) { | |
| - | curlx_unicodefree(domain.tchar_ptr); |
| + | curlx_free(domain.tchar_ptr); |
| return CURLE_OUT_OF_MEMORY; | |
| } | |
| @@ -282,7 +282,7 @@ CURLcode Curl_override_sspi_http_realm(const char *chlg, | |
| identity->DomainLength = curlx_uztoul(_tcslen(dup_domain.tchar_ptr)); | |
| dup_domain.tchar_ptr = NULL; | |
| - | curlx_unicodefree(domain.tchar_ptr); |
| + | curlx_free(domain.tchar_ptr); |
| } | |
| else { | |
| /* Unknown specifier, ignore it! */ | |
| @@ -579,7 +579,7 @@ CURLcode Curl_auth_create_digest_http_message(struct Curl_easy *data, | |
| digest->http_context = curlx_calloc(1, sizeof(CtxtHandle)); | |
| if(!digest->http_context) { | |
| Curl_pSecFn->FreeCredentialsHandle(&credentials); | |
| - | curlx_unicodefree(spn); |
| + | curlx_free(spn); |
| Curl_sspi_free_identity(p_identity); | |
| curlx_free(output_token); | |
| return CURLE_OUT_OF_MEMORY; | |
| @@ -592,7 +592,7 @@ CURLcode Curl_auth_create_digest_http_message(struct Curl_easy *data, | |
| &chlg_desc, 0, | |
| digest->http_context, | |
| &resp_desc, &attrs, NULL); | |
| - | curlx_unicodefree(spn); |
| + | curlx_free(spn); |
| if(status == SEC_I_COMPLETE_NEEDED || | |
| status == SEC_I_COMPLETE_AND_CONTINUE) | |
| @@ -71,7 +71,6 @@ TCHAR *Curl_auth_build_spn(const char *service, const char *host, | |
| { | |
| char *utf8_spn = NULL; | |
| TCHAR *tchar_spn = NULL; | |
| - | TCHAR *dupe_tchar_spn = NULL; |
| (void)realm; | |
| @@ -87,16 +86,11 @@ TCHAR *Curl_auth_build_spn(const char *service, const char *host, | |
| if(!utf8_spn) | |
| return NULL; | |
| - | /* Allocate and return a TCHAR based SPN. Since curlx_convert_UTF8_to_tchar |
| - | must be freed by curlx_unicodefree we will dupe the result so that the |
| - | pointer this function returns can be normally free'd. */ |
| + | /* Allocate and return a TCHAR based SPN. */ |
| tchar_spn = curlx_convert_UTF8_to_tchar(utf8_spn); | |
| curlx_free(utf8_spn); | |
| - | if(!tchar_spn) |
| - | return NULL; |
| - | dupe_tchar_spn = curlx_tcsdup(tchar_spn); |
| - | curlx_unicodefree(tchar_spn); |
| - | return dupe_tchar_spn; |
| + | |
| + | return tchar_spn; |
| } | |
| #endif /* USE_WINDOWS_SSPI */ | |
| @@ -547,7 +547,7 @@ static CURLcode schannel_acquire_credential_handle(struct Curl_cfilter *cf, | |
| failf(data, "schannel: Failed to get certificate location" | |
| " or file for %s", | |
| data->set.ssl.primary.clientcert); | |
| - | curlx_unicodefree(cert_path); |
| + | curlx_free(cert_path); |
| return result; | |
| } | |
| } | |
| @@ -558,7 +558,7 @@ static CURLcode schannel_acquire_credential_handle(struct Curl_cfilter *cf, | |
| " for %s", | |
| blob ? "(memory blob)" : data->set.ssl.primary.clientcert); | |
| curlx_free(cert_store_path); | |
| - | curlx_unicodefree(cert_path); |
| + | curlx_free(cert_path); |
| if(fInCert) | |
| curlx_fclose(fInCert); | |
| return CURLE_SSL_CERTPROBLEM; | |
| @@ -576,7 +576,7 @@ static CURLcode schannel_acquire_credential_handle(struct Curl_cfilter *cf, | |
| const char *cert_showfilename_error = blob ? | |
| "(memory blob)" : data->set.ssl.primary.clientcert; | |
| curlx_free(cert_store_path); | |
| - | curlx_unicodefree(cert_path); |
| + | curlx_free(cert_path); |
| if(fInCert) { | |
| long cert_tell = 0; | |
| bool continue_reading = fseek(fInCert, 0, SEEK_END) == 0; | |
| @@ -686,8 +686,8 @@ static CURLcode schannel_acquire_credential_handle(struct Curl_cfilter *cf, | |
| (path_utf8 ? path_utf8 : "(unknown)"), | |
| GetLastError()); | |
| curlx_free(cert_store_path); | |
| - | curlx_unicodefree(path_utf8); |
| - | curlx_unicodefree(cert_path); |
| + | curlx_free(path_utf8); |
| + | curlx_free(cert_path); |
| return CURLE_SSL_CERTPROBLEM; | |
| } | |
| curlx_free(cert_store_path); | |
| @@ -701,7 +701,7 @@ static CURLcode schannel_acquire_credential_handle(struct Curl_cfilter *cf, | |
| cert_thumbprint_data, | |
| &cert_thumbprint.cbData, | |
| NULL, NULL)) { | |
| - | curlx_unicodefree(cert_path); |
| + | curlx_free(cert_path); |
| CertCloseStore(cert_store, 0); | |
| return CURLE_SSL_CERTPROBLEM; | |
| } | |
| @@ -710,7 +710,7 @@ static CURLcode schannel_acquire_credential_handle(struct Curl_cfilter *cf, | |
| cert_store, X509_ASN_ENCODING | PKCS_7_ASN_ENCODING, 0, | |
| CERT_FIND_HASH, &cert_thumbprint, NULL); | |
| - | curlx_unicodefree(cert_path); |
| + | curlx_free(cert_path); |
| if(!client_certs[0]) { | |
| /* CRYPT_E_NOT_FOUND / E_INVALIDARG */ | |
| @@ -1485,7 +1485,7 @@ static void schannel_session_free(void *sessionid) | |
| cred->refcount--; | |
| if(cred->refcount == 0) { | |
| Curl_pSecFn->FreeCredentialsHandle(&cred->cred_handle); | |
| - | curlx_unicodefree(cred->sni_hostname); |
| + | curlx_free(cred->sni_hostname); |
| if(cred->client_cert_store) { | |
| CertCloseStore(cred->client_cert_store, 0); | |
| cred->client_cert_store = NULL; | |
| @@ -347,7 +347,7 @@ cleanup: | |
| CloseHandle(ca_file_handle); | |
| } | |
| Curl_safefree(ca_file_buffer); | |
| - | curlx_unicodefree(ca_file_tstr); |
| + | curlx_free(ca_file_tstr); |
| return result; | |
| } | |
| @@ -648,7 +648,7 @@ CURLcode Curl_verify_host(struct Curl_cfilter *cf, struct Curl_easy *data) | |
| result = CURLE_PEER_FAILED_VERIFICATION; | |
| } | |
| - | curlx_unicodefree(cert_hostname); |
| + | curlx_free(cert_hostname); |
| } | |
| } | |
| @@ -593,11 +593,8 @@ CURLcode FindWin32CACert(struct OperationConfig *config, | |
| res_len = SearchPath(NULL, bundle_file, NULL, PATH_MAX, buf, &ptr); | |
| if(res_len > 0) { | |
| - | char *mstr = curlx_convert_tchar_to_UTF8(buf); |
| - | tool_safefree(config->cacert); |
| - | if(mstr) |
| - | config->cacert = curlx_strdup(mstr); |
| - | curlx_unicodefree(mstr); |
| + | curlx_free(config->cacert); |
| + | config->cacert = curlx_convert_tchar_to_UTF8(buf); |
| if(!config->cacert) | |
| result = CURLE_OUT_OF_MEMORY; | |
| } | |
| @@ -47,7 +47,7 @@ int getfiletime(const char *filename, curl_off_t *stamp) | |
| (FILE_SHARE_READ | FILE_SHARE_WRITE | | |
| FILE_SHARE_DELETE), | |
| NULL, OPEN_EXISTING, 0, NULL); | |
| - | curlx_unicodefree(tchar_filename); |
| + | curlx_free(tchar_filename); |
| if(hfile != INVALID_HANDLE_VALUE) { | |
| FILETIME ft; | |
| if(GetFileTime(hfile, NULL, NULL, &ft)) { | |
| @@ -113,7 +113,7 @@ void setfiletime(curl_off_t filetime, const char *filename) | |
| (FILE_SHARE_READ | FILE_SHARE_WRITE | | |
| FILE_SHARE_DELETE), | |
| NULL, OPEN_EXISTING, 0, NULL); | |
| - | curlx_unicodefree(tchar_filename); |
| + | curlx_free(tchar_filename); |
| if(hfile != INVALID_HANDLE_VALUE) { | |
| curl_off_t converted = ((curl_off_t)filetime * 10000000) + | |
| 116444736000000000; | |
| @@ -383,7 +383,7 @@ ParameterError parse_args(int argc, argv_item_t argv[]); | |
| #define convert_UTF8_to_tchar(ptr) curlx_convert_UTF8_to_wchar((ptr)) | |
| #define convert_tchar_to_UTF8(ptr) curlx_convert_wchar_to_UTF8((ptr)) | |
| - | #define unicodefree(ptr) curlx_unicodefree(ptr) |
| + | #define unicodefree(ptr) curlx_free(ptr) |
| #else | |
| @@ -50,7 +50,7 @@ Accept: */* | |
| </protocol> | |
| <limits> | |
| - | Allocations: 120 |
| + | Allocations: 135 |
| Maximum allocated: 136000 | |
| </limits> | |
| </verify> | |
| @@ -74,7 +74,7 @@ https://this.hsts.example./%TESTNUMBER | |
| 56 | |
| </errorcode> | |
| <limits> | |
| - | Allocations: 145 |
| + | Allocations: 160 |
| </limits> | |
| </verify> | |
| </testcase> | |
| @@ -51,7 +51,7 @@ Accept: */* | |
| </protocol> | |
| <limits> | |
| - | Allocations: 120 |
| + | Allocations: 135 |
| Maximum allocated: 136000 | |
| </limits> | |
| </verify> | |
| @@ -191,7 +191,8 @@ sub memanalyze { | |
| if($sizeataddr{$addr} && $sizeataddr{$addr}>0) { | |
| # this means weeeeeirdo | |
| - | push @res, "Mixed debug compile, rebuild curl now\n"; |
| + | push @res, "Mixed debug compile ($source:$linenum at line $lnum), rebuild curl now\n"; |
| + | push @res, "We think $sizeataddr{$addr} bytes are already allocated at that memory address: $addr!\n"; |
| } | |
| $sizeataddr{$addr} = $size; | |