From 8a52b16e0d3f407d101f073c5d1b2c0ebaa8c7e7 Mon Sep 17 00:00:00 2001 From: Hans Leidekker Date: Mon, 19 Apr 2021 10:04:52 +0200 Subject: [PATCH] wldap32: Use CRT memory allocators. Signed-off-by: Hans Leidekker Signed-off-by: Alexandre Julliard --- dlls/wldap32/add.c | 12 +- dlls/wldap32/ber.c | 20 ++-- dlls/wldap32/bind.c | 66 +++++------ dlls/wldap32/compare.c | 36 +++--- dlls/wldap32/delete.c | 12 +- dlls/wldap32/dn.c | 12 +- dlls/wldap32/extended.c | 8 +- dlls/wldap32/init.c | 46 ++++---- dlls/wldap32/misc.c | 18 +-- dlls/wldap32/modify.c | 12 +- dlls/wldap32/modrdn.c | 24 ++-- dlls/wldap32/option.c | 4 +- dlls/wldap32/page.c | 26 ++--- dlls/wldap32/rename.c | 24 ++-- dlls/wldap32/search.c | 32 +++--- dlls/wldap32/value.c | 18 +-- dlls/wldap32/winldap_private.h | 200 +++++++++++++++------------------ 17 files changed, 275 insertions(+), 295 deletions(-) diff --git a/dlls/wldap32/add.c b/dlls/wldap32/add.c index cce7726a241..605c1535914 100644 --- a/dlls/wldap32/add.c +++ b/dlls/wldap32/add.c @@ -49,7 +49,7 @@ ULONG CDECL ldap_addA( WLDAP32_LDAP *ld, char *dn, LDAPModA **attrs ) ret = ldap_addW( ld, dnW, attrsW ); exit: - strfreeW( dnW ); + free( dnW ); modarrayfreeW( attrsW ); return ret; } @@ -110,7 +110,7 @@ ULONG CDECL ldap_add_extA( WLDAP32_LDAP *ld, char *dn, LDAPModA **attrs, LDAPCon ret = ldap_add_extW( ld, dnW, attrsW, serverctrlsW, clientctrlsW, message ); exit: - strfreeW( dnW ); + free( dnW ); modarrayfreeW( attrsW ); controlarrayfreeW( serverctrlsW ); controlarrayfreeW( clientctrlsW ); @@ -160,7 +160,7 @@ ULONG CDECL ldap_add_extW( WLDAP32_LDAP *ld, WCHAR *dn, LDAPModW **attrs, LDAPCo ret = map_error( ldap_funcs->ldap_add_ext( ld->ld, dnU, attrsU, serverctrlsU, clientctrlsU, message ) ); exit: - strfreeU( dnU ); + free( dnU ); modarrayfreeU( attrsU ); controlarrayfreeU( serverctrlsU ); controlarrayfreeU( clientctrlsU ); @@ -192,7 +192,7 @@ ULONG CDECL ldap_add_ext_sA( WLDAP32_LDAP *ld, char *dn, LDAPModA **attrs, LDAPC ret = ldap_add_ext_sW( ld, dnW, attrsW, serverctrlsW, clientctrlsW ); exit: - strfreeW( dnW ); + free( dnW ); modarrayfreeW( attrsW ); controlarrayfreeW( serverctrlsW ); controlarrayfreeW( clientctrlsW ); @@ -240,7 +240,7 @@ ULONG CDECL ldap_add_ext_sW( WLDAP32_LDAP *ld, WCHAR *dn, LDAPModW **attrs, LDAP ret = map_error( ldap_funcs->ldap_add_ext_s( ld->ld, dnU, attrsU, serverctrlsU, clientctrlsU ) ); exit: - strfreeU( dnU ); + free( dnU ); modarrayfreeU( attrsU ); controlarrayfreeU( serverctrlsU ); controlarrayfreeU( clientctrlsU ); @@ -268,7 +268,7 @@ ULONG CDECL ldap_add_sA( WLDAP32_LDAP *ld, char *dn, LDAPModA **attrs ) ret = ldap_add_sW( ld, dnW, attrsW ); exit: - strfreeW( dnW ); + free( dnW ); modarrayfreeW( attrsW ); return ret; } diff --git a/dlls/wldap32/ber.c b/dlls/wldap32/ber.c index c6dca7153a2..ffb8e862d0e 100644 --- a/dlls/wldap32/ber.c +++ b/dlls/wldap32/ber.c @@ -19,12 +19,12 @@ */ #include +#include #include "windef.h" #include "winbase.h" #include "winnls.h" #include "wine/debug.h" -#include "wine/heap.h" #include "winldap_private.h" WINE_DEFAULT_DEBUG_CHANNEL(wldap32); @@ -48,10 +48,10 @@ WLDAP32_BerElement * CDECL WLDAP32_ber_alloc_t( int options ) { WLDAP32_BerElement *ret; - if (!(ret = heap_alloc( sizeof(*ret) ))) return NULL; + if (!(ret = malloc( sizeof(*ret) ))) return NULL; if (!(ret->opaque = ldap_funcs->ber_alloc_t( options ))) { - heap_free( ret ); + free( ret ); return NULL; } return ret; @@ -117,7 +117,7 @@ void CDECL WLDAP32_ber_bvecfree( BERVAL **berval ) */ void CDECL WLDAP32_ber_bvfree( BERVAL *berval ) { - heap_free( berval ); + free( berval ); } @@ -194,7 +194,7 @@ int CDECL WLDAP32_ber_flatten( WLDAP32_BerElement *ber, BERVAL **berval ) void CDECL WLDAP32_ber_free( WLDAP32_BerElement *ber, int freebuf ) { ldap_funcs->ber_free( ber->opaque, freebuf ); - heap_free( ber ); + free( ber ); } @@ -218,18 +218,18 @@ WLDAP32_BerElement * CDECL WLDAP32_ber_init( BERVAL *berval ) struct bervalU *bervalU; WLDAP32_BerElement *ret; - if (!(ret = heap_alloc( sizeof(*ret) ))) return NULL; + if (!(ret = malloc( sizeof(*ret) ))) return NULL; if (!(bervalU = bervalWtoU( berval ))) { - heap_free( ret ); + free( ret ); return NULL; } if (!(ret->opaque = ldap_funcs->ber_init( bervalU ))) { - heap_free( ret ); + free( ret ); ret = NULL; } - heap_free( bervalU ); + free( bervalU ); return ret; } @@ -467,7 +467,7 @@ ULONG WINAPIV WLDAP32_ber_scanf( WLDAP32_BerElement *ber, char *fmt, ... ) char *strU, **str = va_arg( list, char ** ); int *len = va_arg( list, int * ); if ((ret = ldap_funcs->ber_scanf( ber->opaque, new_fmt, &strU, len )) == -1) break; - *str = heap_alloc( *len ); + *str = malloc( *len ); memcpy( *str, strU, *len ); ldap_funcs->ldap_memfree( strU ); break; diff --git a/dlls/wldap32/bind.c b/dlls/wldap32/bind.c index 0078b532e66..c9a597e8868 100644 --- a/dlls/wldap32/bind.c +++ b/dlls/wldap32/bind.c @@ -19,13 +19,13 @@ */ #include +#include #include "windef.h" #include "winbase.h" #include "winnls.h" #include "rpc.h" #include "wine/debug.h" -#include "wine/heap.h" #include "winldap_private.h" WINE_DEFAULT_DEBUG_CHANNEL(wldap32); @@ -50,8 +50,8 @@ ULONG CDECL ldap_bindA( WLDAP32_LDAP *ld, char *dn, char *cred, ULONG method ) ret = ldap_bindW( ld, dnW, credW, method ); exit: - strfreeW( dnW ); - strfreeW( credW ); + free( dnW ); + free( credW ); return ret; } @@ -100,8 +100,8 @@ ULONG CDECL ldap_bindW( WLDAP32_LDAP *ld, WCHAR *dn, WCHAR *cred, ULONG method ) ret = ~0u; exit: - strfreeU( dnU ); - strfreeU( credU ); + free( dnU ); + free( credU ); return ret; } @@ -132,8 +132,8 @@ ULONG CDECL ldap_bind_sA( WLDAP32_LDAP *ld, char *dn, char *cred, ULONG method ) ret = ldap_bind_sW( ld, dnW, credW, method ); exit: - strfreeW( dnW ); - if (credW != (WCHAR *)cred) strfreeW( credW ); + free( dnW ); + if (credW != (WCHAR *)cred) free( credW ); return ret; } @@ -235,14 +235,14 @@ ULONG CDECL ldap_bind_sW( WLDAP32_LDAP *ld, WCHAR *dn, WCHAR *cred, ULONG method if (id && (id->Flags & SEC_WINNT_AUTH_IDENTITY_ANSI)) { - strfreeW( (WCHAR *)idW.Domain ); - strfreeW( (WCHAR *)idW.User ); - strfreeW( (WCHAR *)idW.Password ); + free( (WCHAR *)idW.Domain ); + free( (WCHAR *)idW.User ); + free( (WCHAR *)idW.Password ); } - strfreeU( (char *)idU.Domain ); - strfreeU( (char *)idU.User ); - strfreeU( (char *)idU.Password ); + free( (char *)idU.Domain ); + free( (char *)idU.User ); + free( (char *)idU.Password ); } else { @@ -251,8 +251,8 @@ ULONG CDECL ldap_bind_sW( WLDAP32_LDAP *ld, WCHAR *dn, WCHAR *cred, ULONG method } exit: - strfreeU( dnU ); - strfreeU( credU ); + free( dnU ); + free( credU ); return ret; } @@ -282,8 +282,8 @@ ULONG CDECL ldap_sasl_bindA( WLDAP32_LDAP *ld, const PCHAR dn, const PCHAR mecha ret = ldap_sasl_bindW( ld, dnW, mechanismW, cred, serverctrlsW, clientctrlsW, message ); exit: - strfreeW( dnW ); - strfreeW( mechanismW ); + free( dnW ); + free( mechanismW ); controlarrayfreeW( serverctrlsW ); controlarrayfreeW( clientctrlsW ); return ret; @@ -336,8 +336,8 @@ ULONG CDECL ldap_sasl_bindW( WLDAP32_LDAP *ld, const PWCHAR dn, const PWCHAR mec ret = map_error( ldap_funcs->ldap_sasl_bind( ld->ld, dnU, mechanismU, &credU, serverctrlsU, clientctrlsU, message ) ); exit: - strfreeU( dnU ); - strfreeU( mechanismU ); + free( dnU ); + free( mechanismU ); controlarrayfreeU( serverctrlsU ); controlarrayfreeU( clientctrlsU ); return ret; @@ -369,8 +369,8 @@ ULONG CDECL ldap_sasl_bind_sA( WLDAP32_LDAP *ld, const PCHAR dn, const PCHAR mec ret = ldap_sasl_bind_sW( ld, dnW, mechanismW, cred, serverctrlsW, clientctrlsW, serverdata ); exit: - strfreeW( dnW ); - strfreeW( mechanismW ); + free( dnW ); + free( mechanismW ); controlarrayfreeW( serverctrlsW ); controlarrayfreeW( clientctrlsW ); return ret; @@ -431,8 +431,8 @@ ULONG CDECL ldap_sasl_bind_sW( WLDAP32_LDAP *ld, const PWCHAR dn, } exit: - strfreeU( dnU ); - strfreeU( mechanismU ); + free( dnU ); + free( mechanismU ); controlarrayfreeU( serverctrlsU ); controlarrayfreeU( clientctrlsU ); return ret; @@ -458,8 +458,8 @@ ULONG CDECL ldap_simple_bindA( WLDAP32_LDAP *ld, char *dn, char *passwd ) ret = ldap_simple_bindW( ld, dnW, passwdW ); exit: - strfreeW( dnW ); - strfreeW( passwdW ); + free( dnW ); + free( passwdW ); return ret; } @@ -506,8 +506,8 @@ ULONG CDECL ldap_simple_bindW( WLDAP32_LDAP *ld, WCHAR *dn, WCHAR *passwd ) ret = ~0u; exit: - strfreeU( dnU ); - strfreeU( passwdU ); + free( dnU ); + free( passwdU ); return ret; } @@ -531,8 +531,8 @@ ULONG CDECL ldap_simple_bind_sA( WLDAP32_LDAP *ld, char *dn, char *passwd ) ret = ldap_simple_bind_sW( ld, dnW, passwdW ); exit: - strfreeW( dnW ); - strfreeW( passwdW ); + free( dnW ); + free( passwdW ); return ret; } @@ -574,8 +574,8 @@ ULONG CDECL ldap_simple_bind_sW( WLDAP32_LDAP *ld, WCHAR *dn, WCHAR *passwd ) ret = map_error( ldap_funcs->ldap_sasl_bind_s( ld->ld, dnU, 0, &pwd, NULL, NULL, NULL ) ); exit: - strfreeU( dnU ); - strfreeU( passwdU ); + free( dnU ); + free( passwdU ); return ret; } @@ -602,7 +602,7 @@ ULONG CDECL WLDAP32_ldap_unbind( WLDAP32_LDAP *ld ) ret = map_error( ldap_funcs->ldap_unbind_ext( ld->ld, NULL, NULL )); if (ld->ld_server_ctrls) ldap_funcs->ldap_value_free_len( ld->ld_server_ctrls ); - heap_free( ld ); + free( ld ); return ret; } @@ -629,6 +629,6 @@ ULONG CDECL WLDAP32_ldap_unbind_s( WLDAP32_LDAP *ld ) ret = map_error( ldap_funcs->ldap_unbind_ext_s( ld->ld, NULL, NULL ) ); if (ld->ld_server_ctrls) ldap_funcs->ldap_value_free_len( ld->ld_server_ctrls ); - heap_free( ld ); + free( ld ); return ret; } diff --git a/dlls/wldap32/compare.c b/dlls/wldap32/compare.c index 7a366572dc9..63b56ef9f4c 100644 --- a/dlls/wldap32/compare.c +++ b/dlls/wldap32/compare.c @@ -49,9 +49,9 @@ ULONG CDECL ldap_compareA( WLDAP32_LDAP *ld, char *dn, char *attr, char *value ) ret = ldap_compareW( ld, dnW, attrW, valueW ); exit: - strfreeW( dnW ); - strfreeW( attrW ); - strfreeW( valueW ); + free( dnW ); + free( attrW ); + free( valueW ); return ret; } @@ -108,9 +108,9 @@ ULONG CDECL ldap_compare_extA( WLDAP32_LDAP *ld, char *dn, char *attr, char *val ret = ldap_compare_extW( ld, dnW, attrW, valueW, data, serverctrlsW, clientctrlsW, message ); exit: - strfreeW( dnW ); - strfreeW( attrW ); - strfreeW( valueW ); + free( dnW ); + free( attrW ); + free( valueW ); controlarrayfreeW( serverctrlsW ); controlarrayfreeW( clientctrlsW ); return ret; @@ -173,9 +173,9 @@ ULONG CDECL ldap_compare_extW( WLDAP32_LDAP *ld, WCHAR *dn, WCHAR *attr, WCHAR * ret = map_error( ldap_funcs->ldap_compare_ext( ld->ld, dnU, attrU, dataU ? dataU : &val, serverctrlsU, clientctrlsU, message ) ); exit: - strfreeU( dnU ); - strfreeU( attrU ); - strfreeU( valueU ); + free( dnU ); + free( attrU ); + free( valueU ); bvfreeU( dataU ); controlarrayfreeU( serverctrlsU ); controlarrayfreeU( clientctrlsU ); @@ -208,9 +208,9 @@ ULONG CDECL ldap_compare_ext_sA( WLDAP32_LDAP *ld, char *dn, char *attr, char *v ret = ldap_compare_ext_sW( ld, dnW, attrW, valueW, data, serverctrlsW, clientctrlsW ); exit: - strfreeW( dnW ); - strfreeW( attrW ); - strfreeW( valueW ); + free( dnW ); + free( attrW ); + free( valueW ); controlarrayfreeW( serverctrlsW ); controlarrayfreeW( clientctrlsW ); return ret; @@ -271,9 +271,9 @@ ULONG CDECL ldap_compare_ext_sW( WLDAP32_LDAP *ld, WCHAR *dn, WCHAR *attr, WCHAR ret = map_error( ldap_funcs->ldap_compare_ext_s( ld->ld, dnU, attrU, dataU ? dataU : &val, serverctrlsU, clientctrlsU ) ); exit: - strfreeU( dnU ); - strfreeU( attrU ); - strfreeU( valueU ); + free( dnU ); + free( attrU ); + free( valueU ); bvfreeU( dataU ); controlarrayfreeU( serverctrlsU ); controlarrayfreeU( clientctrlsU ); @@ -301,9 +301,9 @@ ULONG CDECL ldap_compare_sA( WLDAP32_LDAP *ld, PCHAR dn, PCHAR attr, PCHAR value ret = ldap_compare_sW( ld, dnW, attrW, valueW ); exit: - strfreeW( dnW ); - strfreeW( attrW ); - strfreeW( valueW ); + free( dnW ); + free( attrW ); + free( valueW ); return ret; } diff --git a/dlls/wldap32/delete.c b/dlls/wldap32/delete.c index 9f2b107f62c..2f3d078629f 100644 --- a/dlls/wldap32/delete.c +++ b/dlls/wldap32/delete.c @@ -44,7 +44,7 @@ ULONG CDECL ldap_deleteA( WLDAP32_LDAP *ld, char *dn ) if (dn && !(dnW = strAtoW( dn ))) return WLDAP32_LDAP_NO_MEMORY; ret = ldap_deleteW( ld, dnW ); - strfreeW( dnW ); + free( dnW ); return ret; } @@ -100,7 +100,7 @@ ULONG CDECL ldap_delete_extA( WLDAP32_LDAP *ld, char *dn, LDAPControlA **serverc ret = ldap_delete_extW( ld, dnW, serverctrlsW, clientctrlsW, message ); exit: - strfreeW( dnW ); + free( dnW ); controlarrayfreeW( serverctrlsW ); controlarrayfreeW( clientctrlsW ); return ret; @@ -145,7 +145,7 @@ ULONG CDECL ldap_delete_extW( WLDAP32_LDAP *ld, WCHAR *dn, LDAPControlW **server ret = map_error( ldap_funcs->ldap_delete_ext( ld->ld, dnU, serverctrlsU, clientctrlsU, message ) ); exit: - strfreeU( dnU ); + free( dnU ); controlarrayfreeU( serverctrlsU ); controlarrayfreeU( clientctrlsU ); return ret; @@ -174,7 +174,7 @@ ULONG CDECL ldap_delete_ext_sA( WLDAP32_LDAP *ld, char *dn, LDAPControlA **serve ret = ldap_delete_ext_sW( ld, dnW, serverctrlsW, clientctrlsW ); exit: - strfreeW( dnW ); + free( dnW ); controlarrayfreeW( serverctrlsW ); controlarrayfreeW( clientctrlsW ); return ret; @@ -217,7 +217,7 @@ ULONG CDECL ldap_delete_ext_sW( WLDAP32_LDAP *ld, WCHAR *dn, LDAPControlW **serv ret = map_error( ldap_funcs->ldap_delete_ext_s( ld->ld, dnU, serverctrlsU, clientctrlsU ) ); exit: - strfreeU( dnU ); + free( dnU ); controlarrayfreeU( serverctrlsU ); controlarrayfreeU( clientctrlsU ); return ret; @@ -239,7 +239,7 @@ ULONG CDECL ldap_delete_sA( WLDAP32_LDAP *ld, char *dn ) if (dn && !(dnW = strAtoW( dn ))) return WLDAP32_LDAP_NO_MEMORY; ret = ldap_delete_sW( ld, dnW ); - strfreeW( dnW ); + free( dnW ); return ret; } diff --git a/dlls/wldap32/dn.c b/dlls/wldap32/dn.c index 61d421ee233..e9a6be999a8 100644 --- a/dlls/wldap32/dn.c +++ b/dlls/wldap32/dn.c @@ -45,7 +45,7 @@ char * CDECL ldap_dn2ufnA( char *dn ) retW = ldap_dn2ufnW( dnW ); ret = strWtoA( retW ); - strfreeW( dnW ); + free( dnW ); ldap_memfreeW( retW ); return ret; } @@ -77,7 +77,7 @@ WCHAR * CDECL ldap_dn2ufnW( WCHAR *dn ) retU = ldap_funcs->ldap_dn2ufn( dnU ); ret = strUtoW( retU ); - strfreeU( dnU ); + free( dnU ); ldap_funcs->ldap_memfree( retU ); return ret; } @@ -99,7 +99,7 @@ char ** CDECL ldap_explode_dnA( char *dn, ULONG notypes ) retW = ldap_explode_dnW( dnW, notypes ); ret = strarrayWtoA( retW ); - strfreeW( dnW ); + free( dnW ); ldap_value_freeW( retW ); return ret; } @@ -133,7 +133,7 @@ WCHAR ** CDECL ldap_explode_dnW( WCHAR *dn, ULONG notypes ) retU = ldap_funcs->ldap_explode_dn( dnU, notypes ); ret = strarrayUtoW( retU ); - strfreeU( dnU ); + free( dnU ); ldap_funcs->ldap_memvfree( (void **)retU ); return ret; } @@ -216,7 +216,7 @@ ULONG CDECL ldap_ufn2dnA( char *ufn, char **dn ) else *dn = str; } - strfreeW( ufnW ); + free( ufnW ); ldap_memfreeW( dnW ); return ret; } @@ -257,6 +257,6 @@ ULONG CDECL ldap_ufn2dnW( WCHAR *ufn, WCHAR **dn ) else *dn = str; } - strfreeU( ufnU ); + free( ufnU ); return ret; } diff --git a/dlls/wldap32/extended.c b/dlls/wldap32/extended.c index e09d90fdc60..2a71ce59acf 100644 --- a/dlls/wldap32/extended.c +++ b/dlls/wldap32/extended.c @@ -76,7 +76,7 @@ ULONG CDECL ldap_extended_operationA( WLDAP32_LDAP *ld, char *oid, struct WLDAP3 ret = ldap_extended_operationW( ld, oidW, data, serverctrlsW, clientctrlsW, message ); exit: - strfreeW( oidW ); + free( oidW ); controlarrayfreeW( serverctrlsW ); controlarrayfreeW( clientctrlsW ); return ret; @@ -127,7 +127,7 @@ ULONG CDECL ldap_extended_operationW( WLDAP32_LDAP *ld, WCHAR *oid, struct WLDAP ret = map_error( ldap_funcs->ldap_extended_operation( ld->ld, oidU, dataU, serverctrlsU, clientctrlsU, message ) ); exit: - strfreeU( oidU ); + free( oidU ); bvfreeU( dataU ); controlarrayfreeU( serverctrlsU ); controlarrayfreeU( clientctrlsU ); @@ -164,7 +164,7 @@ ULONG CDECL ldap_extended_operation_sA( WLDAP32_LDAP *ld, char *oid, struct WLDA } exit: - strfreeW( oidW ); + free( oidW ); controlarrayfreeW( serverctrlsW ); controlarrayfreeW( clientctrlsW ); return ret; @@ -229,7 +229,7 @@ ULONG CDECL ldap_extended_operation_sW( WLDAP32_LDAP *ld, WCHAR *oid, struct WLD } exit: - strfreeU( oidU ); + free( oidU ); bvfreeU( dataU ); controlarrayfreeU( serverctrlsU ); controlarrayfreeU( clientctrlsU ); diff --git a/dlls/wldap32/init.c b/dlls/wldap32/init.c index d65554afb3c..28e62ba6de2 100644 --- a/dlls/wldap32/init.c +++ b/dlls/wldap32/init.c @@ -19,13 +19,13 @@ */ #include +#include #include "windef.h" #include "winbase.h" #include "winnls.h" #include "winternl.h" #include "wine/debug.h" -#include "wine/heap.h" #include "winldap_private.h" WINE_DEFAULT_DEBUG_CHANNEL(wldap32); @@ -56,9 +56,9 @@ static char **split_hostnames( const char *hostnames ) p++; } - if (!(res = heap_alloc( (i + 1) * sizeof(char *) ))) + if (!(res = malloc( (i + 1) * sizeof(char *) ))) { - heap_free( str ); + free( str ); return NULL; } @@ -93,15 +93,13 @@ static char **split_hostnames( const char *hostnames ) } res[i] = NULL; - heap_free( str ); + free( str ); return res; oom: - while (i > 0) strfreeU( res[--i] ); - - heap_free( res ); - heap_free( str ); - + while (i > 0) free( res[--i] ); + free( res ); + free( str ); return NULL; } @@ -147,7 +145,7 @@ static char *join_hostnames( const char *scheme, char **hostnames, ULONG portnum } size += (i - 1) * strlen( sep ); - if (!(res = heap_alloc( size + 1 ))) return NULL; + if (!(res = malloc( size + 1 ))) return NULL; p = res; for (v = hostnames; *v; v++) @@ -200,10 +198,10 @@ static WLDAP32_LDAP *create_context( const char *url ) WLDAP32_LDAP *ld; int version = WLDAP32_LDAP_VERSION3; - if (!(ld = heap_alloc_zero( sizeof( *ld )))) return NULL; + if (!(ld = calloc( 1, sizeof( *ld )))) return NULL; if (map_error( ldap_funcs->ldap_initialize( &ld->ld, url ) ) != WLDAP32_LDAP_SUCCESS) { - heap_free( ld ); + free( ld ); return NULL; } ldap_funcs->ldap_set_option( ld->ld, WLDAP32_LDAP_OPT_PROTOCOL_VERSION, &version ); @@ -226,7 +224,7 @@ WLDAP32_LDAP * CDECL cldap_openA( char *hostname, ULONG portnumber ) ld = cldap_openW( hostnameW, portnumber ); - strfreeW( hostnameW ); + free( hostnameW ); return ld; } @@ -264,8 +262,8 @@ WLDAP32_LDAP * CDECL cldap_openW( WCHAR *hostname, ULONG portnumber ) ld = create_context( url ); exit: - strfreeU( hostnameU ); - strfreeU( url ); + free( hostnameU ); + free( url ); return ld; } @@ -311,7 +309,7 @@ WLDAP32_LDAP * CDECL ldap_initA( const PCHAR hostname, ULONG portnumber ) ld = ldap_initW( hostnameW, portnumber ); - strfreeW( hostnameW ); + free( hostnameW ); return ld; } @@ -350,8 +348,8 @@ WLDAP32_LDAP * CDECL ldap_initW( const PWCHAR hostname, ULONG portnumber ) ld = create_context( url ); exit: - strfreeU( hostnameU ); - strfreeU( url ); + free( hostnameU ); + free( url ); return ld; } @@ -371,7 +369,7 @@ WLDAP32_LDAP * CDECL ldap_openA( char *hostname, ULONG portnumber ) ld = ldap_openW( hostnameW, portnumber ); - strfreeW( hostnameW ); + free( hostnameW ); return ld; } @@ -409,8 +407,8 @@ WLDAP32_LDAP * CDECL ldap_openW( WCHAR *hostname, ULONG portnumber ) ld = create_context( url ); exit: - strfreeU( hostnameU ); - strfreeU( url ); + free( hostnameU ); + free( url ); return ld; } @@ -430,7 +428,7 @@ WLDAP32_LDAP * CDECL ldap_sslinitA( char *hostname, ULONG portnumber, int secure ld = ldap_sslinitW( hostnameW, portnumber, secure ); - strfreeW( hostnameW ); + free( hostnameW ); return ld; } @@ -475,8 +473,8 @@ WLDAP32_LDAP * CDECL ldap_sslinitW( WCHAR *hostname, ULONG portnumber, int secur ld = create_context( url ); exit: - strfreeU( hostnameU ); - strfreeU( url ); + free( hostnameU ); + free( url ); return ld; } diff --git a/dlls/wldap32/misc.c b/dlls/wldap32/misc.c index 234b84d42f9..330355e573c 100644 --- a/dlls/wldap32/misc.c +++ b/dlls/wldap32/misc.c @@ -19,12 +19,12 @@ */ #include +#include #include "windef.h" #include "winbase.h" #include "winnls.h" #include "wine/debug.h" -#include "wine/heap.h" #include "winldap_private.h" WINE_DEFAULT_DEBUG_CHANNEL(wldap32); @@ -67,7 +67,7 @@ ULONG CDECL ldap_check_filterA( WLDAP32_LDAP *ld, char *filter ) ret = ldap_check_filterW( ld, filterW ); - strfreeW( filterW ); + free( filterW ); return ret; } @@ -299,7 +299,7 @@ WCHAR * CDECL ldap_first_attributeW( WLDAP32_LDAP *ld, WLDAP32_LDAPMessage *entr if (!ld || !entry) return NULL; retU = ldap_funcs->ldap_first_attribute( ld->ld, entry->Request, &berU ); - if (retU && (ber = heap_alloc( sizeof(*ber) ))) + if (retU && (ber = malloc( sizeof(*ber) ))) { ber->opaque = (char *)berU; *ptr = ber; @@ -383,7 +383,7 @@ WLDAP32_LDAPMessage * CDECL WLDAP32_ldap_first_reference( WLDAP32_LDAP *ld, WLDA void CDECL ldap_memfreeA( char *block ) { TRACE( "(%p)\n", block ); - strfreeA( block ); + free( block ); } /*********************************************************************** @@ -397,7 +397,7 @@ void CDECL ldap_memfreeA( char *block ) void CDECL ldap_memfreeW( WCHAR *block ) { TRACE( "(%p)\n", block ); - strfreeW( block ); + free( block ); } /*********************************************************************** @@ -421,7 +421,7 @@ ULONG CDECL WLDAP32_ldap_msgfree( WLDAP32_LDAPMessage *res ) { entry = list; list = entry->lm_next; - heap_free( entry ); + free( entry ); } return WLDAP32_LDAP_SUCCESS; @@ -516,7 +516,7 @@ WLDAP32_LDAPMessage * CDECL WLDAP32_ldap_next_entry( WLDAP32_LDAP *ld, WLDAP32_L if (entry->lm_next) return entry->lm_next; msgU = ldap_funcs->ldap_next_entry( ld->ld, entry->Request ); - if (msgU && (msg = heap_alloc_zero( sizeof(*msg) ))) + if (msgU && (msg = calloc( 1, sizeof(*msg) ))) { msg->Request = msgU; entry->lm_next = msg; @@ -553,7 +553,7 @@ WLDAP32_LDAPMessage * CDECL WLDAP32_ldap_next_reference( WLDAP32_LDAP *ld, WLDAP if (entry->lm_next) return entry->lm_next; msgU = ldap_funcs->ldap_next_reference( ld->ld, entry->Request ); - if (msgU && (msg = heap_alloc_zero( sizeof(*msg) ))) + if (msgU && (msg = calloc( 1, sizeof(*msg) ))) { msg->Request = msgU; entry->lm_next = msg; @@ -617,7 +617,7 @@ ULONG CDECL WLDAP32_ldap_result( WLDAP32_LDAP *ld, ULONG msgid, ULONG all, struc } ret = ldap_funcs->ldap_result( ld->ld, msgid, all, timeout ? &timeval : NULL, &msgU ); - if (msgU && (msg = heap_alloc_zero( sizeof(*msg) ))) + if (msgU && (msg = calloc( 1, sizeof(*msg) ))) { msg->Request = msgU; *res = msg; diff --git a/dlls/wldap32/modify.c b/dlls/wldap32/modify.c index 9655a0cf15e..280989f88b4 100644 --- a/dlls/wldap32/modify.c +++ b/dlls/wldap32/modify.c @@ -49,7 +49,7 @@ ULONG CDECL ldap_modifyA( WLDAP32_LDAP *ld, char *dn, LDAPModA **mods ) ret = ldap_modifyW( ld, dnW, modsW ); exit: - strfreeW( dnW ); + free( dnW ); modarrayfreeW( modsW ); return ret; } @@ -110,7 +110,7 @@ ULONG CDECL ldap_modify_extA( WLDAP32_LDAP *ld, char *dn, LDAPModA **mods, ret = ldap_modify_extW( ld, dnW, modsW, serverctrlsW, clientctrlsW, message ); exit: - strfreeW( dnW ); + free( dnW ); modarrayfreeW( modsW ); controlarrayfreeW( serverctrlsW ); controlarrayfreeW( clientctrlsW ); @@ -160,7 +160,7 @@ ULONG CDECL ldap_modify_extW( WLDAP32_LDAP *ld, WCHAR *dn, LDAPModW **mods, ret = map_error( ldap_funcs->ldap_modify_ext( ld->ld, dnU, modsU, serverctrlsU, clientctrlsU, message ) ); exit: - strfreeU( dnU ); + free( dnU ); modarrayfreeU( modsU ); controlarrayfreeU( serverctrlsU ); controlarrayfreeU( clientctrlsU ); @@ -192,7 +192,7 @@ ULONG CDECL ldap_modify_ext_sA( WLDAP32_LDAP *ld, char *dn, LDAPModA **mods, ret = ldap_modify_ext_sW( ld, dnW, modsW, serverctrlsW, clientctrlsW ); exit: - strfreeW( dnW ); + free( dnW ); modarrayfreeW( modsW ); controlarrayfreeW( serverctrlsW ); controlarrayfreeW( clientctrlsW ); @@ -240,7 +240,7 @@ ULONG CDECL ldap_modify_ext_sW( WLDAP32_LDAP *ld, WCHAR *dn, LDAPModW **mods, ret = map_error( ldap_funcs->ldap_modify_ext_s( ld->ld, dnU, modsU, serverctrlsU, clientctrlsU ) ); exit: - strfreeU( dnU ); + free( dnU ); modarrayfreeU( modsU ); controlarrayfreeU( serverctrlsU ); controlarrayfreeU( clientctrlsU ); @@ -268,7 +268,7 @@ ULONG CDECL ldap_modify_sA( WLDAP32_LDAP *ld, char *dn, LDAPModA **mods ) ret = ldap_modify_sW( ld, dnW, modsW ); exit: - strfreeW( dnW ); + free( dnW ); modarrayfreeW( modsW ); return ret; } diff --git a/dlls/wldap32/modrdn.c b/dlls/wldap32/modrdn.c index c297c7e90b6..937bd651f5e 100644 --- a/dlls/wldap32/modrdn.c +++ b/dlls/wldap32/modrdn.c @@ -48,8 +48,8 @@ ULONG CDECL ldap_modrdnA( WLDAP32_LDAP *ld, char *dn, char *newdn ) ret = ldap_modrdnW( ld, dnW, newdnW ); exit: - strfreeW( dnW ); - strfreeW( newdnW ); + free( dnW ); + free( newdnW ); return ret; } @@ -98,8 +98,8 @@ ULONG CDECL ldap_modrdn2A( WLDAP32_LDAP *ld, char *dn, char *newdn, int delete ) ret = ldap_modrdn2W( ld, dnW, newdnW, delete ); exit: - strfreeW( dnW ); - strfreeW( newdnW ); + free( dnW ); + free( newdnW ); return ret; } @@ -143,8 +143,8 @@ ULONG CDECL ldap_modrdn2W( WLDAP32_LDAP *ld, WCHAR *dn, WCHAR *newdn, int delete ret = ~0u; exit: - strfreeU( dnU ); - strfreeU( newdnU ); + free( dnU ); + free( newdnU ); return ret; } @@ -168,8 +168,8 @@ ULONG CDECL ldap_modrdn2_sA( WLDAP32_LDAP *ld, char *dn, char *newdn, int delete ret = ldap_modrdn2_sW( ld, dnW, newdnW, delete ); exit: - strfreeW( dnW ); - strfreeW( newdnW ); + free( dnW ); + free( newdnW ); return ret; } @@ -203,8 +203,8 @@ ULONG CDECL ldap_modrdn2_sW( WLDAP32_LDAP *ld, WCHAR *dn, WCHAR *newdn, int dele ret = map_error( ldap_funcs->ldap_rename_s( ld->ld, dnU, newdnU, NULL, delete, NULL, NULL )); exit: - strfreeU( dnU ); - strfreeU( newdnU ); + free( dnU ); + free( newdnU ); return ret; } @@ -228,8 +228,8 @@ ULONG CDECL ldap_modrdn_sA( WLDAP32_LDAP *ld, char *dn, char *newdn ) ret = ldap_modrdn_sW( ld, dnW, newdnW ); exit: - strfreeW( dnW ); - strfreeW( newdnW ); + free( dnW ); + free( newdnW ); return ret; } diff --git a/dlls/wldap32/option.c b/dlls/wldap32/option.c index 49eac7d2e94..f307837d83a 100644 --- a/dlls/wldap32/option.c +++ b/dlls/wldap32/option.c @@ -57,7 +57,7 @@ ULONG CDECL ldap_get_optionA( WLDAP32_LDAP *ld, int option, void *value ) ret = ldap_get_optionW( ld, option, &featureW ); if (ret == WLDAP32_LDAP_SUCCESS) featureA->ldapaif_version = featureW.ldapaif_version; - strfreeW( featureW.ldapaif_name ); + free( featureW.ldapaif_name ); return ret; } case WLDAP32_LDAP_OPT_API_INFO: @@ -185,7 +185,7 @@ ULONG CDECL ldap_get_optionW( WLDAP32_LDAP *ld, int option, void *value ) ret = map_error( ldap_funcs->ldap_get_option( ld->ld, option, &featureU ) ); if (ret == WLDAP32_LDAP_SUCCESS) featureW->ldapaif_version = featureU.ldapaif_version; - strfreeU( featureU.ldapaif_name ); + free( featureU.ldapaif_name ); return ret; } case WLDAP32_LDAP_OPT_API_INFO: diff --git a/dlls/wldap32/page.c b/dlls/wldap32/page.c index 49be2203b3f..19110aa10ce 100644 --- a/dlls/wldap32/page.c +++ b/dlls/wldap32/page.c @@ -19,12 +19,12 @@ */ #include +#include #include "windef.h" #include "winbase.h" #include "winnls.h" #include "wine/debug.h" -#include "wine/heap.h" #include "winldap_private.h" WINE_DEFAULT_DEBUG_CHANNEL(wldap32); @@ -82,20 +82,20 @@ static ULONG create_page_control( ULONG pagesize, struct WLDAP32_berval *cookie, if (ret == -1) return WLDAP32_LDAP_NO_MEMORY; /* copy the berval so it can be properly freed by the caller */ - if (!(val = heap_alloc( berval->bv_len ))) return WLDAP32_LDAP_NO_MEMORY; + if (!(val = malloc( berval->bv_len ))) return WLDAP32_LDAP_NO_MEMORY; len = berval->bv_len; memcpy( val, berval->bv_val, len ); WLDAP32_ber_bvfree( berval ); - if (!(ctrl = heap_alloc( sizeof(*ctrl) ))) + if (!(ctrl = malloc( sizeof(*ctrl) ))) { - heap_free( val ); + free( val ); return WLDAP32_LDAP_NO_MEMORY; } if (!(ctrl->ldctl_oid = strAtoW( LDAP_PAGED_RESULT_OID_STRING ))) { - heap_free( ctrl ); + free( ctrl ); return WLDAP32_LDAP_NO_MEMORY; } ctrl->ldctl_value.bv_len = len; @@ -196,7 +196,7 @@ ULONG CDECL ldap_get_paged_count( WLDAP32_LDAP *ld, LDAPSearch *search, ULONG *c return WLDAP32_LDAP_SUCCESS; } - heap_free( search->cookie ); + free( search->cookie ); search->cookie = NULL; ret = ldap_parse_page_controlW( ld, server_ctrls, count, &search->cookie ); @@ -272,17 +272,17 @@ ULONG CDECL ldap_search_abandon_page( WLDAP32_LDAP *ld, LDAPSearch *search ) if (!ld || !search) return ~0u; - strfreeW( search->dn ); - strfreeW( search->filter ); + free( search->dn ); + free( search->filter ); strarrayfreeW( search->attrs ); ctrls = search->serverctrls; controlfreeW( ctrls[0] ); /* page control */ ctrls++; while (*ctrls) controlfreeW( *ctrls++ ); - heap_free( search->serverctrls ); + free( search->serverctrls ); controlarrayfreeW( search->clientctrls ); - if (search->cookie && search->cookie != &null_cookieW) heap_free( search->cookie ); - heap_free( search ); + if (search->cookie && search->cookie != &null_cookieW) free( search->cookie ); + free( search ); return WLDAP32_LDAP_SUCCESS; } @@ -306,7 +306,7 @@ LDAPSearch * CDECL ldap_search_init_pageW( WLDAP32_LDAP *ld, WCHAR *dn, ULONG sc TRACE( "(%p, %s, 0x%08x, %s, %p, 0x%08x, %p, %p, 0x%08x, 0x%08x, %p)\n", ld, debugstr_w(dn), scope, debugstr_w(filter), attrs, attrsonly, serverctrls, clientctrls, timelimit, sizelimit, sortkeys ); - if (!(search = heap_alloc_zero( sizeof(*search) ))) + if (!(search = calloc( 1, sizeof(*search) ))) { ld->ld_errno = WLDAP32_LDAP_NO_MEMORY; return NULL; @@ -317,7 +317,7 @@ LDAPSearch * CDECL ldap_search_init_pageW( WLDAP32_LDAP *ld, WCHAR *dn, ULONG sc if (attrs && !(search->attrs = strarraydupW( attrs ))) goto fail; len = serverctrls ? controlarraylenW( serverctrls ) : 0; - if (!(search->serverctrls = heap_alloc( sizeof(LDAPControlW *) * (len + 2) ))) goto fail; + if (!(search->serverctrls = malloc( sizeof(LDAPControlW *) * (len + 2) ))) goto fail; search->serverctrls[0] = NULL; /* reserve 0 for page control */ for (i = 0; i < len; i++) { diff --git a/dlls/wldap32/rename.c b/dlls/wldap32/rename.c index cba4cdd7b66..b5e06f3f7dd 100644 --- a/dlls/wldap32/rename.c +++ b/dlls/wldap32/rename.c @@ -54,9 +54,9 @@ ULONG CDECL ldap_rename_extA( WLDAP32_LDAP *ld, char *dn, char *newrdn, char *ne ret = ldap_rename_extW( ld, dnW, newrdnW, newparentW, delete, serverctrlsW, clientctrlsW, message ); exit: - strfreeW( dnW ); - strfreeW( newrdnW ); - strfreeW( newparentW ); + free( dnW ); + free( newrdnW ); + free( newparentW ); controlarrayfreeW( serverctrlsW ); controlarrayfreeW( clientctrlsW ); return ret; @@ -107,9 +107,9 @@ ULONG CDECL ldap_rename_extW( WLDAP32_LDAP *ld, WCHAR *dn, WCHAR *newrdn, WCHAR ret = map_error( ldap_funcs->ldap_rename( ld->ld, dnU, newrdnU, newparentU, delete, serverctrlsU, clientctrlsU, message ) ); exit: - strfreeU( dnU ); - strfreeU( newrdnU ); - strfreeU( newparentU ); + free( dnU ); + free( newrdnU ); + free( newparentU ); controlarrayfreeU( serverctrlsU ); controlarrayfreeU( clientctrlsU ); return ret; @@ -141,9 +141,9 @@ ULONG CDECL ldap_rename_ext_sA( WLDAP32_LDAP *ld, char *dn, char *newrdn, char * ret = ldap_rename_ext_sW( ld, dnW, newrdnW, newparentW, delete, serverctrlsW, clientctrlsW ); exit: - strfreeW( dnW ); - strfreeW( newrdnW ); - strfreeW( newparentW ); + free( dnW ); + free( newrdnW ); + free( newparentW ); controlarrayfreeW( serverctrlsW ); controlarrayfreeW( clientctrlsW ); return ret; @@ -187,9 +187,9 @@ ULONG CDECL ldap_rename_ext_sW( WLDAP32_LDAP *ld, WCHAR *dn, WCHAR *newrdn, WCHA ret = map_error( ldap_funcs->ldap_rename_s( ld->ld, dnU, newrdnU, newparentU, delete, serverctrlsU, clientctrlsU ) ); exit: - strfreeU( dnU ); - strfreeU( newrdnU ); - strfreeU( newparentU ); + free( dnU ); + free( newrdnU ); + free( newparentU ); controlarrayfreeU( serverctrlsU ); controlarrayfreeU( clientctrlsU ); return ret; diff --git a/dlls/wldap32/search.c b/dlls/wldap32/search.c index b4bf204f817..7a496e02af3 100644 --- a/dlls/wldap32/search.c +++ b/dlls/wldap32/search.c @@ -19,12 +19,12 @@ */ #include +#include #include "windef.h" #include "winbase.h" #include "winnls.h" #include "wine/debug.h" -#include "wine/heap.h" #include "winldap_private.h" WINE_DEFAULT_DEBUG_CHANNEL(wldap32); @@ -50,8 +50,8 @@ ULONG CDECL ldap_searchA( WLDAP32_LDAP *ld, char *base, ULONG scope, char *filte ret = ldap_searchW( ld, baseW, scope, filterW, attrsW, attrsonly ); exit: - strfreeW( baseW ); - strfreeW( filterW ); + free( baseW ); + free( filterW ); strarrayfreeW( attrsW ); return ret; } @@ -116,8 +116,8 @@ ULONG CDECL ldap_search_extA( WLDAP32_LDAP *ld, char *base, ULONG scope, char *f sizelimit, message ); exit: - strfreeW( baseW ); - strfreeW( filterW ); + free( baseW ); + free( filterW ); strarrayfreeW( attrsW ); controlarrayfreeW( serverctrlsW ); controlarrayfreeW( clientctrlsW ); @@ -179,8 +179,8 @@ ULONG CDECL ldap_search_extW( WLDAP32_LDAP *ld, WCHAR *base, ULONG scope, WCHAR serverctrlsU, clientctrlsU, timelimit ? &timevalU : NULL, sizelimit, message ) ); exit: - strfreeU( baseU ); - strfreeU( filterU ); + free( baseU ); + free( filterU ); strarrayfreeU( attrsU ); controlarrayfreeU( serverctrlsU ); controlarrayfreeU( clientctrlsU ); @@ -215,8 +215,8 @@ ULONG CDECL ldap_search_ext_sA( WLDAP32_LDAP *ld, char *base, ULONG scope, char sizelimit, res ); exit: - strfreeW( baseW ); - strfreeW( filterW ); + free( baseW ); + free( filterW ); strarrayfreeW( attrsW ); controlarrayfreeW( serverctrlsW ); controlarrayfreeW( clientctrlsW ); @@ -280,7 +280,7 @@ ULONG CDECL ldap_search_ext_sW( WLDAP32_LDAP *ld, WCHAR *base, ULONG scope, WCHA clientctrlsU, timeout ? &timevalU : NULL, sizelimit, &msgU ) ); if (msgU) { - WLDAP32_LDAPMessage *msg = heap_alloc_zero( sizeof(*msg) ); + WLDAP32_LDAPMessage *msg = calloc( 1, sizeof(*msg) ); if (msg) { msg->Request = msgU; @@ -294,8 +294,8 @@ ULONG CDECL ldap_search_ext_sW( WLDAP32_LDAP *ld, WCHAR *base, ULONG scope, WCHA } exit: - strfreeU( baseU ); - strfreeU( filterU ); + free( baseU ); + free( filterU ); strarrayfreeU( attrsU ); controlarrayfreeU( serverctrlsU ); controlarrayfreeU( clientctrlsU ); @@ -325,8 +325,8 @@ ULONG CDECL ldap_search_sA( WLDAP32_LDAP *ld, char *base, ULONG scope, char *fil ret = ldap_search_sW( ld, baseW, scope, filterW, attrsW, attrsonly, res ); exit: - strfreeW( baseW ); - strfreeW( filterW ); + free( baseW ); + free( filterW ); strarrayfreeW( attrsW ); return ret; } @@ -384,8 +384,8 @@ ULONG CDECL ldap_search_stA( WLDAP32_LDAP *ld, const PCHAR base, ULONG scope, co ret = ldap_search_stW( ld, baseW, scope, filterW, attrsW, attrsonly, timeout, res ); exit: - strfreeW( baseW ); - strfreeW( filterW ); + free( baseW ); + free( filterW ); strarrayfreeW( attrsW ); return ret; } diff --git a/dlls/wldap32/value.c b/dlls/wldap32/value.c index 249a2fae605..b2111557afb 100644 --- a/dlls/wldap32/value.c +++ b/dlls/wldap32/value.c @@ -19,12 +19,12 @@ */ #include +#include #include "windef.h" #include "winbase.h" #include "winnls.h" #include "wine/debug.h" -#include "wine/heap.h" #include "winldap_private.h" WINE_DEFAULT_DEBUG_CHANNEL(wldap32); @@ -120,7 +120,7 @@ char ** CDECL ldap_get_valuesA( WLDAP32_LDAP *ld, WLDAP32_LDAPMessage *entry, ch ret = strarrayWtoA( retW ); ldap_value_freeW( retW ); - strfreeW( attrW ); + free( attrW ); return ret; } @@ -129,7 +129,7 @@ static char *bv2str( struct bervalU *bv ) char *str = NULL; unsigned int len = bv->bv_len; - if ((str = heap_alloc( len + 1 ))) + if ((str = malloc( len + 1 ))) { memcpy( str, bv->bv_val, len ); str[len] = '\0'; @@ -148,7 +148,7 @@ static char **bv2str_array( struct bervalU **bv ) len++; p++; } - if (!(str = heap_alloc( (len + 1) * sizeof(char *) ))) return NULL; + if (!(str = malloc( (len + 1) * sizeof(char *) ))) return NULL; p = bv; while (*p) @@ -156,8 +156,8 @@ static char **bv2str_array( struct bervalU **bv ) str[i] = bv2str( *p ); if (!str[i]) { - while (i > 0) heap_free( str[--i] ); - heap_free( str ); + while (i > 0) free( str[--i] ); + free( str ); return NULL; } i++; @@ -205,7 +205,7 @@ WCHAR ** CDECL ldap_get_valuesW( WLDAP32_LDAP *ld, WLDAP32_LDAPMessage *entry, W strarrayfreeU( retU ); } - strfreeU( attrU ); + free( attrU ); return ret; } @@ -225,7 +225,7 @@ struct WLDAP32_berval ** CDECL ldap_get_values_lenA( WLDAP32_LDAP *ld, WLDAP32_L ret = ldap_get_values_lenW( ld, message, attrW ); - strfreeW( attrW ); + free( attrW ); return ret; } @@ -264,7 +264,7 @@ struct WLDAP32_berval ** CDECL ldap_get_values_lenW( WLDAP32_LDAP *ld, WLDAP32_L bvarrayfreeU( retU ); } - strfreeU( attrU ); + free( attrU ); return ret; } diff --git a/dlls/wldap32/winldap_private.h b/dlls/wldap32/winldap_private.h index 2f5b4dcff72..6777c114d81 100644 --- a/dlls/wldap32/winldap_private.h +++ b/dlls/wldap32/winldap_private.h @@ -23,6 +23,7 @@ */ #include +#include #include "winternl.h" #include "winnls.h" #include "libldap.h" @@ -509,7 +510,7 @@ static inline char *strdupU( const char *src ) { char *dst; if (!src) return NULL; - if ((dst = RtlAllocateHeap( GetProcessHeap(), 0, (strlen( src ) + 1) * sizeof(char) ))) strcpy( dst, src ); + if ((dst = malloc( strlen( src ) + 1 ))) strcpy( dst, src ); return dst; } @@ -517,7 +518,7 @@ static inline WCHAR *strdupW( const WCHAR *src ) { WCHAR *dst; if (!src) return NULL; - if ((dst = RtlAllocateHeap( GetProcessHeap(), 0, (lstrlenW( src ) + 1) * sizeof(WCHAR) ))) lstrcpyW( dst, src ); + if ((dst = malloc( (lstrlenW( src ) + 1) * sizeof(WCHAR) ))) lstrcpyW( dst, src ); return dst; } @@ -527,8 +528,7 @@ static inline char *strWtoU( const WCHAR *str ) if (str) { int len = WideCharToMultiByte( CP_UTF8, 0, str, -1, NULL, 0, NULL, NULL ); - if ((ret = RtlAllocateHeap( GetProcessHeap(), 0, len ))) - WideCharToMultiByte( CP_UTF8, 0, str, -1, ret, len, NULL, NULL ); + if ((ret = malloc( len ))) WideCharToMultiByte( CP_UTF8, 0, str, -1, ret, len, NULL, NULL ); } return ret; } @@ -540,7 +540,7 @@ static inline char *strnWtoU( const WCHAR *str, DWORD in_len, DWORD *out_len ) if (str) { DWORD len = WideCharToMultiByte( CP_UTF8, 0, str, in_len, NULL, 0, NULL, NULL ); - if ((ret = RtlAllocateHeap( GetProcessHeap(), 0, len + 1 ))) + if ((ret = malloc( len + 1 ))) { WideCharToMultiByte( CP_UTF8, 0, str, in_len, ret, len, NULL, NULL ); ret[len] = 0; @@ -550,28 +550,17 @@ static inline char *strnWtoU( const WCHAR *str, DWORD in_len, DWORD *out_len ) return ret; } -static inline void strfreeU( char *str ) -{ - RtlFreeHeap( GetProcessHeap(), 0, str ); -} - static inline WCHAR *strAtoW( const char *str ) { WCHAR *ret = NULL; if (str) { DWORD len = MultiByteToWideChar( CP_ACP, 0, str, -1, NULL, 0 ); - if ((ret = RtlAllocateHeap( GetProcessHeap(), 0, len * sizeof(WCHAR) ))) - MultiByteToWideChar( CP_ACP, 0, str, -1, ret, len ); + if ((ret = malloc( len * sizeof(WCHAR) ))) MultiByteToWideChar( CP_ACP, 0, str, -1, ret, len ); } return ret; } -static inline void strfreeW( WCHAR *str ) -{ - RtlFreeHeap( GetProcessHeap(), 0, str ); -} - static inline WCHAR *strnAtoW( const char *str, DWORD in_len, DWORD *out_len ) { WCHAR *ret = NULL; @@ -579,7 +568,7 @@ static inline WCHAR *strnAtoW( const char *str, DWORD in_len, DWORD *out_len ) if (str) { DWORD len = MultiByteToWideChar( CP_ACP, 0, str, in_len, NULL, 0 ); - if ((ret = RtlAllocateHeap( GetProcessHeap(), 0, (len + 1) * sizeof(WCHAR) ))) + if ((ret = malloc( (len + 1) * sizeof(WCHAR) ))) { MultiByteToWideChar( CP_ACP, 0, str, in_len, ret, len ); ret[len] = 0; @@ -611,7 +600,7 @@ static inline char **strarrayWtoU( WCHAR **strarray ) if (strarray) { size = sizeof(char *) * (strarraylenW( strarray ) + 1); - if ((strarrayU = RtlAllocateHeap( GetProcessHeap(), 0, size ))) + if ((strarrayU = malloc( size ))) { WCHAR **p = strarray; char **q = strarrayU; @@ -631,7 +620,7 @@ static inline WCHAR **strarraydupW( WCHAR **strarray ) if (strarray) { size = sizeof(WCHAR *) * (strarraylenW( strarray ) + 1); - if ((strarrayW = RtlAllocateHeap( GetProcessHeap(), 0, size ))) + if ((strarrayW = malloc( size ))) { WCHAR **p = strarray; WCHAR **q = strarrayW; @@ -649,8 +638,7 @@ static inline char *strWtoA( const WCHAR *str ) if (str) { DWORD len = WideCharToMultiByte( CP_ACP, 0, str, -1, NULL, 0, NULL, NULL ); - if ((ret = RtlAllocateHeap( GetProcessHeap(), 0, len ))) - WideCharToMultiByte( CP_ACP, 0, str, -1, ret, len, NULL, NULL ); + if ((ret = malloc( len ))) WideCharToMultiByte( CP_ACP, 0, str, -1, ret, len, NULL, NULL ); } return ret; } @@ -663,7 +651,7 @@ static inline char **strarrayWtoA( WCHAR **strarray ) if (strarray) { size = sizeof(char *) * (strarraylenW( strarray ) + 1); - if ((strarrayA = RtlAllocateHeap( GetProcessHeap(), 0, size ))) + if ((strarrayA = malloc( size ))) { WCHAR **p = strarray; char **q = strarrayA; @@ -689,7 +677,7 @@ static inline struct bervalU *bervalWtoU( const struct WLDAP32_berval *bv ) struct bervalU *berval; DWORD size = sizeof(*berval) + bv->bv_len; - if ((berval = RtlAllocateHeap( GetProcessHeap(), 0, size ))) + if ((berval = malloc( size ))) { char *val = (char *)(berval + 1); @@ -714,7 +702,7 @@ static inline struct WLDAP32_berval *bervalUtoW( const struct bervalU *bv ) assert( bv->bv_len <= ~0u ); - if ((berval = RtlAllocateHeap( GetProcessHeap(), 0, size ))) + if ((berval = malloc( size ))) { char *val = (char *)(berval + 1); @@ -733,7 +721,7 @@ static inline struct WLDAP32_berval **bvarrayUtoW( struct bervalU **bv ) if (bv) { size = sizeof(*berval) * (bvarraylenU( bv ) + 1); - if ((berval = RtlAllocateHeap( GetProcessHeap(), 0, size ))) + if ((berval = malloc( size ))) { struct bervalU **p = bv; struct WLDAP32_berval **q = berval; @@ -747,7 +735,7 @@ static inline struct WLDAP32_berval **bvarrayUtoW( struct bervalU **bv ) static inline void bvfreeU( struct bervalU *berval ) { - RtlFreeHeap( GetProcessHeap(), 0, berval ); + free( berval ); } static inline struct bervalU **bvarrayWtoU( struct WLDAP32_berval **bv ) @@ -758,7 +746,7 @@ static inline struct bervalU **bvarrayWtoU( struct WLDAP32_berval **bv ) if (bv) { size = sizeof(*berval) * (bvarraylenW( bv ) + 1); - if ((berval = RtlAllocateHeap( GetProcessHeap(), 0, size ))) + if ((berval = malloc( size ))) { struct WLDAP32_berval **p = bv; struct bervalU **q = berval; @@ -774,7 +762,7 @@ static inline LDAPModU *modWtoU( const LDAPModW *mod ) { LDAPModU *modU; - if ((modU = RtlAllocateHeap( GetProcessHeap(), 0, sizeof(LDAPModU) ))) + if ((modU = malloc( sizeof(*modU) ))) { modU->mod_op = mod->mod_op; modU->mod_type = strWtoU( mod->mod_type ); @@ -795,7 +783,7 @@ static inline LDAPModU **modarrayWtoU( LDAPModW **modarray ) if (modarray) { size = sizeof(LDAPModU *) * (modarraylenW( modarray ) + 1); - if ((modarrayU = RtlAllocateHeap( GetProcessHeap(), 0, size ))) + if ((modarrayU = malloc( size ))) { LDAPModW **p = modarray; LDAPModU **q = modarrayU; @@ -810,8 +798,8 @@ static inline LDAPModU **modarrayWtoU( LDAPModW **modarray ) static inline void bvarrayfreeU( struct bervalU **bv ) { struct bervalU **p = bv; - while (*p) RtlFreeHeap( GetProcessHeap(), 0, *p++ ); - RtlFreeHeap( GetProcessHeap(), 0, bv ); + while (*p) free( *p++ ); + free( bv ); } static inline void strarrayfreeU( char **strarray ) @@ -819,8 +807,8 @@ static inline void strarrayfreeU( char **strarray ) if (strarray) { char **p = strarray; - while (*p) strfreeU( *p++ ); - RtlFreeHeap( GetProcessHeap(), 0, strarray ); + while (*p) free( *p++ ); + free( strarray ); } } @@ -830,7 +818,7 @@ static inline void modfreeU( LDAPModU *mod ) bvarrayfreeU( mod->mod_vals.modv_bvals ); else strarrayfreeU( mod->mod_vals.modv_strvals ); - RtlFreeHeap( GetProcessHeap(), 0, mod ); + free( mod ); } static inline void modarrayfreeU( LDAPModU **modarray ) @@ -839,7 +827,7 @@ static inline void modarrayfreeU( LDAPModU **modarray ) { LDAPModU **p = modarray; while (*p) modfreeU( *p++ ); - RtlFreeHeap( GetProcessHeap(), 0, modarray ); + free( modarray ); } } @@ -855,7 +843,7 @@ static inline struct WLDAP32_berval *bervalWtoW( const struct WLDAP32_berval *bv struct WLDAP32_berval *berval; DWORD size = sizeof(*berval) + bv->bv_len; - if ((berval = RtlAllocateHeap( GetProcessHeap(), 0, size ))) + if ((berval = malloc( size ))) { char *val = (char *)(berval + 1); @@ -874,7 +862,7 @@ static inline struct WLDAP32_berval **bvarrayWtoW( struct WLDAP32_berval **bv ) if (bv) { size = sizeof(*berval) * (bvarraylenW( bv ) + 1); - if ((berval = RtlAllocateHeap( GetProcessHeap(), 0, size ))) + if ((berval = malloc( size ))) { struct WLDAP32_berval **p = bv; struct WLDAP32_berval **q = berval; @@ -901,7 +889,7 @@ static inline WCHAR **strarrayAtoW( char **strarray ) if (strarray) { size = sizeof(WCHAR *) * (strarraylenA( strarray ) + 1); - if ((strarrayW = RtlAllocateHeap( GetProcessHeap(), 0, size ))) + if ((strarrayW = malloc( size ))) { char **p = strarray; WCHAR **q = strarrayW; @@ -917,7 +905,7 @@ static inline LDAPModW *modAtoW( const LDAPModA *mod ) { LDAPModW *modW; - if ((modW = RtlAllocateHeap( GetProcessHeap(), 0, sizeof(LDAPModW) ))) + if ((modW = malloc( sizeof(*modW) ))) { modW->mod_op = mod->mod_op; modW->mod_type = strAtoW( mod->mod_type ); @@ -938,7 +926,7 @@ static inline LDAPModW **modarrayAtoW( LDAPModA **modarray ) if (modarray) { size = sizeof(LDAPModW *) * (modarraylenA( modarray ) + 1); - if ((modarrayW = RtlAllocateHeap( GetProcessHeap(), 0, size ))) + if ((modarrayW = malloc( size ))) { LDAPModA **p = modarray; LDAPModW **q = modarrayW; @@ -953,8 +941,8 @@ static inline LDAPModW **modarrayAtoW( LDAPModA **modarray ) static inline void bvarrayfreeW( struct WLDAP32_berval **bv ) { struct WLDAP32_berval **p = bv; - while (*p) RtlFreeHeap( GetProcessHeap(), 0, *p++ ); - RtlFreeHeap( GetProcessHeap(), 0, bv ); + while (*p) free( *p++ ); + free( bv ); } static inline void strarrayfreeW( WCHAR **strarray ) @@ -962,8 +950,8 @@ static inline void strarrayfreeW( WCHAR **strarray ) if (strarray) { WCHAR **p = strarray; - while (*p) strfreeW( *p++ ); - RtlFreeHeap( GetProcessHeap(), 0, strarray ); + while (*p) free( *p++ ); + free( strarray ); } } @@ -973,7 +961,7 @@ static inline void modfreeW( LDAPModW *mod ) bvarrayfreeW( mod->mod_vals.modv_bvals ); else strarrayfreeW( mod->mod_vals.modv_strvals ); - RtlFreeHeap( GetProcessHeap(), 0, mod ); + free( mod ); } static inline void modarrayfreeW( LDAPModW **modarray ) @@ -982,7 +970,7 @@ static inline void modarrayfreeW( LDAPModW **modarray ) { LDAPModW **p = modarray; while (*p) modfreeW( *p++ ); - RtlFreeHeap( GetProcessHeap(), 0, modarray ); + free( modarray ); } } @@ -1001,13 +989,13 @@ static inline LDAPControlW *controlAtoW( const LDAPControlA *control ) if (control->ldctl_value.bv_val) { - if (!(val = RtlAllocateHeap( GetProcessHeap(), 0, len ))) return NULL; + if (!(val = malloc( len ))) return NULL; memcpy( val, control->ldctl_value.bv_val, len ); } - if (!(controlW = RtlAllocateHeap( GetProcessHeap(), 0, sizeof(LDAPControlW) ))) + if (!(controlW = malloc( sizeof(*controlW) ))) { - RtlFreeHeap( GetProcessHeap(), 0, val ); + free( val ); return NULL; } @@ -1027,7 +1015,7 @@ static inline LDAPControlW **controlarrayAtoW( LDAPControlA **controlarray ) if (controlarray) { size = sizeof(LDAPControlW *) * (controlarraylenA( controlarray ) + 1); - if ((controlarrayW = RtlAllocateHeap( GetProcessHeap(), 0, size ))) + if ((controlarrayW = malloc( size ))) { LDAPControlA **p = controlarray; LDAPControlW **q = controlarrayW; @@ -1043,9 +1031,9 @@ static inline void controlfreeW( LDAPControlW *control ) { if (control) { - strfreeW( control->ldctl_oid ); - RtlFreeHeap( GetProcessHeap(), 0, control->ldctl_value.bv_val ); - RtlFreeHeap( GetProcessHeap(), 0, control ); + free( control->ldctl_oid ); + free( control->ldctl_value.bv_val ); + free( control ); } } @@ -1055,7 +1043,7 @@ static inline void controlarrayfreeW( LDAPControlW **controlarray ) { LDAPControlW **p = controlarray; while (*p) controlfreeW( *p++ ); - RtlFreeHeap( GetProcessHeap(), 0, controlarray ); + free( controlarray ); } } @@ -1074,13 +1062,13 @@ static inline LDAPControlA *controlWtoA( const LDAPControlW *control ) if (control->ldctl_value.bv_val) { - if (!(val = RtlAllocateHeap( GetProcessHeap(), 0, len ))) return NULL; + if (!(val = malloc( len ))) return NULL; memcpy( val, control->ldctl_value.bv_val, len ); } - if (!(controlA = RtlAllocateHeap( GetProcessHeap(), 0, sizeof(LDAPControlA) ))) + if (!(controlA = malloc( sizeof(*controlA) ))) { - RtlFreeHeap( GetProcessHeap(), 0, val ); + free( val ); return NULL; } @@ -1092,18 +1080,13 @@ static inline LDAPControlA *controlWtoA( const LDAPControlW *control ) return controlA; } -static inline void strfreeA( char *str ) -{ - RtlFreeHeap( GetProcessHeap(), 0, str ); -} - static inline void strarrayfreeA( char **strarray ) { if (strarray) { char **p = strarray; - while (*p) strfreeA( *p++ ); - RtlFreeHeap( GetProcessHeap(), 0, strarray ); + while (*p) free( *p++ ); + free( strarray ); } } @@ -1111,9 +1094,9 @@ static inline void controlfreeA( LDAPControlA *control ) { if (control) { - strfreeA( control->ldctl_oid ); - RtlFreeHeap( GetProcessHeap(), 0, control->ldctl_value.bv_val ); - RtlFreeHeap( GetProcessHeap(), 0, control ); + free( control->ldctl_oid ); + free( control->ldctl_value.bv_val ); + free( control ); } } @@ -1123,7 +1106,7 @@ static inline void controlarrayfreeA( LDAPControlA **controlarray ) { LDAPControlA **p = controlarray; while (*p) controlfreeA( *p++ ); - RtlFreeHeap( GetProcessHeap(), 0, controlarray ); + free( controlarray ); } } @@ -1135,13 +1118,13 @@ static inline LDAPControlU *controlWtoU( const LDAPControlW *control ) if (control->ldctl_value.bv_val) { - if (!(val = RtlAllocateHeap( GetProcessHeap(), 0, len ))) return NULL; + if (!(val = malloc( len ))) return NULL; memcpy( val, control->ldctl_value.bv_val, len ); } - if (!(controlU = RtlAllocateHeap( GetProcessHeap(), 0, sizeof(LDAPControlU) ))) + if (!(controlU = malloc( sizeof(*controlU) ))) { - RtlFreeHeap( GetProcessHeap(), 0, val ); + free( val ); return NULL; } @@ -1161,7 +1144,7 @@ static inline LDAPControlU **controlarrayWtoU( LDAPControlW **controlarray ) if (controlarray) { size = sizeof(LDAPControlU *) * (controlarraylenW( controlarray ) + 1); - if ((controlarrayU = RtlAllocateHeap( GetProcessHeap(), 0, size ))) + if ((controlarrayU = malloc( size ))) { LDAPControlW **p = controlarray; LDAPControlU **q = controlarrayU; @@ -1177,9 +1160,9 @@ static inline void controlfreeU( LDAPControlU *control ) { if (control) { - strfreeU( control->ldctl_oid ); - RtlFreeHeap( GetProcessHeap(), 0, control->ldctl_value.bv_val ); - RtlFreeHeap( GetProcessHeap(), 0, control ); + free( control->ldctl_oid ); + free( control->ldctl_value.bv_val ); + free( control ); } } @@ -1189,7 +1172,7 @@ static inline void controlarrayfreeU( LDAPControlU **controlarray ) { LDAPControlU **p = controlarray; while (*p) controlfreeU( *p++ ); - RtlFreeHeap( GetProcessHeap(), 0, controlarray ); + free( controlarray ); } } @@ -1208,13 +1191,13 @@ static inline LDAPControlW *controldupW( LDAPControlW *control ) if (control->ldctl_value.bv_val) { - if (!(val = RtlAllocateHeap( GetProcessHeap(), 0, len ))) return NULL; + if (!(val = malloc( len ))) return NULL; memcpy( val, control->ldctl_value.bv_val, len ); } - if (!(controlW = RtlAllocateHeap( GetProcessHeap(), 0, sizeof(LDAPControlW) ))) + if (!(controlW = malloc( sizeof(*controlW) ))) { - RtlFreeHeap( GetProcessHeap(), 0, val ); + free( val ); return NULL; } @@ -1234,7 +1217,7 @@ static inline LDAPControlW **controlarraydupW( LDAPControlW **controlarray ) if (controlarray) { size = sizeof(LDAPControlW *) * (controlarraylenW( controlarray ) + 1); - if ((controlarrayW = RtlAllocateHeap( GetProcessHeap(), 0, size ))) + if ((controlarrayW = malloc( size ))) { LDAPControlW **p = controlarray; LDAPControlW **q = controlarrayW; @@ -1254,7 +1237,7 @@ static inline LDAPControlA **controlarrayWtoA( LDAPControlW **controlarray ) if (controlarray) { size = sizeof(LDAPControlA *) * (controlarraylenW( controlarray ) + 1); - if ((controlarrayA = RtlAllocateHeap( GetProcessHeap(), 0, size ))) + if ((controlarrayA = malloc( size ))) { LDAPControlW **p = controlarray; LDAPControlA **q = controlarrayA; @@ -1272,8 +1255,7 @@ static inline WCHAR *strUtoW( const char *str ) if (str) { DWORD len = MultiByteToWideChar( CP_UTF8, 0, str, -1, NULL, 0 ); - if ((ret = RtlAllocateHeap( GetProcessHeap(), 0, len * sizeof(WCHAR) ))) - MultiByteToWideChar( CP_UTF8, 0, str, -1, ret, len ); + if ((ret = malloc( len * sizeof(WCHAR) ))) MultiByteToWideChar( CP_UTF8, 0, str, -1, ret, len ); } return ret; } @@ -1293,7 +1275,7 @@ static inline WCHAR **strarrayUtoW( char **strarray ) if (strarray) { size = sizeof(WCHAR *) * (strarraylenU( strarray ) + 1); - if ((strarrayW = RtlAllocateHeap( GetProcessHeap(), 0, size ))) + if ((strarrayW = malloc( size ))) { char **p = strarray; WCHAR **q = strarrayW; @@ -1313,7 +1295,7 @@ static inline char **strarrayUtoU( char **strarray ) if (strarray) { size = sizeof(char *) * (strarraylenU( strarray ) + 1); - if ((strarrayU = RtlAllocateHeap( GetProcessHeap(), 0, size ))) + if ((strarrayU = malloc( size ))) { char **p = strarray; char **q = strarrayU; @@ -1333,13 +1315,13 @@ static inline LDAPControlW *controlUtoW( const LDAPControlU *control ) if (control->ldctl_value.bv_val) { - if (!(val = RtlAllocateHeap( GetProcessHeap(), 0, len ))) return NULL; + if (!(val = malloc( len ))) return NULL; memcpy( val, control->ldctl_value.bv_val, len ); } - if (!(controlW = RtlAllocateHeap( GetProcessHeap(), 0, sizeof(LDAPControlW) ))) + if (!(controlW = malloc( sizeof(*controlW) ))) { - RtlFreeHeap( GetProcessHeap(), 0, val ); + free( val ); return NULL; } @@ -1359,7 +1341,7 @@ static inline LDAPControlW **controlarrayUtoW( LDAPControlU **controlarray ) if (controlarray) { size = sizeof(LDAPControlW *) * (controlarraylenU( controlarray ) + 1); - if ((controlarrayW = RtlAllocateHeap( GetProcessHeap(), 0, size ))) + if ((controlarrayW = malloc( size ))) { LDAPControlU **p = controlarray; LDAPControlW **q = controlarrayW; @@ -1382,7 +1364,7 @@ static inline LDAPSortKeyW *sortkeyAtoW( const LDAPSortKeyA *sortkey ) { LDAPSortKeyW *sortkeyW; - if ((sortkeyW = RtlAllocateHeap( GetProcessHeap(), 0, sizeof(LDAPSortKeyW) ))) + if ((sortkeyW = malloc( sizeof(*sortkeyW) ))) { sortkeyW->sk_attrtype = strAtoW( sortkey->sk_attrtype ); sortkeyW->sk_matchruleoid = strAtoW( sortkey->sk_matchruleoid ); @@ -1399,7 +1381,7 @@ static inline LDAPSortKeyW **sortkeyarrayAtoW( LDAPSortKeyA **sortkeyarray ) if (sortkeyarray) { size = sizeof(LDAPSortKeyW *) * (sortkeyarraylenA( sortkeyarray ) + 1); - if ((sortkeyarrayW = RtlAllocateHeap( GetProcessHeap(), 0, size ))) + if ((sortkeyarrayW = malloc( size ))) { LDAPSortKeyA **p = sortkeyarray; LDAPSortKeyW **q = sortkeyarrayW; @@ -1415,9 +1397,9 @@ static inline void sortkeyfreeW( LDAPSortKeyW *sortkey ) { if (sortkey) { - strfreeW( sortkey->sk_attrtype ); - strfreeW( sortkey->sk_matchruleoid ); - RtlFreeHeap( GetProcessHeap(), 0, sortkey ); + free( sortkey->sk_attrtype ); + free( sortkey->sk_matchruleoid ); + free( sortkey ); } } @@ -1427,7 +1409,7 @@ static inline void sortkeyarrayfreeW( LDAPSortKeyW **sortkeyarray ) { LDAPSortKeyW **p = sortkeyarray; while (*p) sortkeyfreeW( *p++ ); - RtlFreeHeap( GetProcessHeap(), 0, sortkeyarray ); + free( sortkeyarray ); } } @@ -1442,7 +1424,7 @@ static inline LDAPSortKeyU *sortkeyWtoU( const LDAPSortKeyW *sortkey ) { LDAPSortKeyU *sortkeyU; - if ((sortkeyU = RtlAllocateHeap( GetProcessHeap(), 0, sizeof(LDAPSortKeyU) ))) + if ((sortkeyU = malloc( sizeof(*sortkeyU) ))) { sortkeyU->attributeType = strWtoU( sortkey->sk_attrtype ); sortkeyU->orderingRule = strWtoU( sortkey->sk_matchruleoid ); @@ -1459,7 +1441,7 @@ static inline LDAPSortKeyU **sortkeyarrayWtoU( LDAPSortKeyW **sortkeyarray ) if (sortkeyarray) { size = sizeof(LDAPSortKeyU *) * (sortkeyarraylenW( sortkeyarray ) + 1); - if ((sortkeyarrayU = RtlAllocateHeap( GetProcessHeap(), 0, size ))) + if ((sortkeyarrayU = malloc( size ))) { LDAPSortKeyW **p = sortkeyarray; LDAPSortKeyU **q = sortkeyarrayU; @@ -1475,9 +1457,9 @@ static inline void sortkeyfreeU( LDAPSortKeyU *sortkey ) { if (sortkey) { - strfreeU( sortkey->attributeType ); - strfreeU( sortkey->orderingRule ); - RtlFreeHeap( GetProcessHeap(), 0, sortkey ); + free( sortkey->attributeType ); + free( sortkey->orderingRule ); + free( sortkey ); } } @@ -1487,7 +1469,7 @@ static inline void sortkeyarrayfreeU( LDAPSortKeyU **sortkeyarray ) { LDAPSortKeyU **p = sortkeyarray; while (*p) sortkeyfreeU( *p++ ); - RtlFreeHeap( GetProcessHeap(), 0, sortkeyarray ); + free( sortkeyarray ); } } @@ -1495,7 +1477,7 @@ static inline LDAPVLVInfoU *vlvinfoWtoU( const WLDAP32_LDAPVLVInfo *info ) { LDAPVLVInfoU *infoU; - if ((infoU = RtlAllocateHeap( GetProcessHeap(), 0, sizeof(*infoU) ))) + if ((infoU = malloc( sizeof(*infoU) ))) { infoU->ldvlv_version = info->ldvlv_version; infoU->ldvlv_before_count = info->ldvlv_before_count; @@ -1504,13 +1486,13 @@ static inline LDAPVLVInfoU *vlvinfoWtoU( const WLDAP32_LDAPVLVInfo *info ) infoU->ldvlv_count = info->ldvlv_count; if (!(infoU->ldvlv_attrvalue = bervalWtoU( info->ldvlv_attrvalue ))) { - RtlFreeHeap( GetProcessHeap(), 0, infoU ); + free( infoU ); return NULL; } if (!(infoU->ldvlv_context = bervalWtoU( info->ldvlv_context ))) { - RtlFreeHeap( GetProcessHeap(), 0, infoU->ldvlv_attrvalue ); - RtlFreeHeap( GetProcessHeap(), 0, infoU ); + free( infoU->ldvlv_attrvalue ); + free( infoU ); return NULL; } infoU->ldvlv_extradata = info->ldvlv_extradata; @@ -1520,7 +1502,7 @@ static inline LDAPVLVInfoU *vlvinfoWtoU( const WLDAP32_LDAPVLVInfo *info ) static inline void vlvinfofreeU( LDAPVLVInfoU *info ) { - RtlFreeHeap( GetProcessHeap(), 0, info->ldvlv_attrvalue ); - RtlFreeHeap( GetProcessHeap(), 0, info->ldvlv_context ); - RtlFreeHeap( GetProcessHeap(), 0, info ); + free( info->ldvlv_attrvalue ); + free( info->ldvlv_context ); + free( info ); }