mirror of
https://github.com/curl/curl.git
synced 2026-08-25 23:43:35 +03:00
curlx: limit use of system allocators to the minimum possible
Clone a multibye conversion function into curlx/fopen, and use that local copy from curlx/fopen functions. Adjust allocators in curlx/fopen to use curl's in normal builds, and system allocators in TrackMemory builds to avoid recursion. This allows to switch curlx/multibyte functions to curl allocators in all configurations, as they are no longer called by curlx/fopen, and a recursive call can no longer happen. After this patch the system allocator is only used in TrackMemory Windows builds, within curlx `fopen`, `freopen`, `stat` and `open` functions. Also: - test 1, 440, 767: raise allocation limitsto fit the extra allocations in Windows Unicode builds. - replace all uses of `curlx_unicodefree()` macro with `curlx_free()` across the codebase. - curlx/multibyte: delete `curlx_unicodefree()`. - ldap: join Windows and non-Windows codepaths that became identical after moving from `curlx_unicodefree()` to `curlx_free()`. - vauth: drop a strdup from standard to curl allocator since the original allocation is now already done by curl's. - tool_doswin: drop now superfluous strdup from `FindWin32CACert()`. - memanalyzer.pm: sync weirdo `calloc` log message with `malloc`'s. Fixes #19748 Closes #19845
This commit is contained in:
parent
2d6ade19fc
commit
4e051ff550
19 changed files with 100 additions and 113 deletions
15
lib/ldap.c
15
lib/ldap.c
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue