Commit 8a52b16e authored by Hans Leidekker's avatar Hans Leidekker Committed by Alexandre Julliard

wldap32: Use CRT memory allocators.

parent e5f1c0f7
......@@ -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;
}
......
......@@ -19,12 +19,12 @@
*/
#include <stdarg.h>
#include <stdlib.h>
#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;
......
......@@ -19,13 +19,13 @@
*/
#include <stdarg.h>
#include <stdlib.h>
#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;
}
......@@ -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;
}
......
......@@ -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;
}
......
......@@ -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;
}
......@@ -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 );
......
......@@ -19,13 +19,13 @@
*/
#include <stdarg.h>
#include <stdlib.h>
#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;
}
......
......@@ -19,12 +19,12 @@
*/
#include <stdarg.h>
#include <stdlib.h>
#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;
......
......@@ -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;
}
......
......@@ -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;
}
......
......@@ -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:
......
......@@ -19,12 +19,12 @@
*/
#include <stdarg.h>
#include <stdlib.h>
#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++)
{
......
......@@ -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;
......
......@@ -19,12 +19,12 @@
*/
#include <stdarg.h>
#include <stdlib.h>
#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;
}
......
......@@ -19,12 +19,12 @@
*/
#include <stdarg.h>
#include <stdlib.h>
#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;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment