Commit 61c5d2a0 authored by Alex Henrie's avatar Alex Henrie Committed by Alexandre Julliard

mpr: Use CRT allocation functions.

parent d8966584
...@@ -38,7 +38,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(mpr); ...@@ -38,7 +38,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(mpr);
*/ */
LPVOID WINAPI MPR_Alloc( DWORD dwSize ) LPVOID WINAPI MPR_Alloc( DWORD dwSize )
{ {
return HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, dwSize ); return calloc( 1, dwSize );
} }
/***************************************************************** /*****************************************************************
...@@ -46,10 +46,7 @@ LPVOID WINAPI MPR_Alloc( DWORD dwSize ) ...@@ -46,10 +46,7 @@ LPVOID WINAPI MPR_Alloc( DWORD dwSize )
*/ */
LPVOID WINAPI MPR_ReAlloc( LPVOID lpSrc, DWORD dwSize ) LPVOID WINAPI MPR_ReAlloc( LPVOID lpSrc, DWORD dwSize )
{ {
if ( lpSrc ) return _recalloc( lpSrc, 1, dwSize );
return HeapReAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, lpSrc, dwSize );
else
return HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, dwSize );
} }
/***************************************************************** /*****************************************************************
...@@ -57,10 +54,8 @@ LPVOID WINAPI MPR_ReAlloc( LPVOID lpSrc, DWORD dwSize ) ...@@ -57,10 +54,8 @@ LPVOID WINAPI MPR_ReAlloc( LPVOID lpSrc, DWORD dwSize )
*/ */
BOOL WINAPI MPR_Free( LPVOID lpMem ) BOOL WINAPI MPR_Free( LPVOID lpMem )
{ {
if ( lpMem ) free( lpMem );
return HeapFree( GetProcessHeap(), 0, lpMem ); return !!lpMem;
else
return FALSE;
} }
/***************************************************************** /*****************************************************************
......
...@@ -55,7 +55,7 @@ static LPSTR MPR_GetValueName( LPCSTR pbResource, WORD cbResource, BYTE nType ) ...@@ -55,7 +55,7 @@ static LPSTR MPR_GetValueName( LPCSTR pbResource, WORD cbResource, BYTE nType )
LPSTR name; LPSTR name;
DWORD i; DWORD i;
name = HeapAlloc( GetProcessHeap(), 0, 6+cbResource*2 ); name = malloc( 6 + cbResource * 2 );
if( !name ) return NULL; if( !name ) return NULL;
sprintf( name, "X-%02X-", nType ); sprintf( name, "X-%02X-", nType );
...@@ -114,7 +114,7 @@ DWORD WINAPI WNetCachePassword( ...@@ -114,7 +114,7 @@ DWORD WINAPI WNetCachePassword(
r = WN_CANCEL; r = WN_CANCEL;
else else
r = WN_SUCCESS; r = WN_SUCCESS;
HeapFree( GetProcessHeap(), 0, valname ); free( valname );
} }
else else
r = WN_OUT_OF_MEMORY; r = WN_OUT_OF_MEMORY;
...@@ -152,7 +152,7 @@ UINT WINAPI WNetRemoveCachedPassword( ...@@ -152,7 +152,7 @@ UINT WINAPI WNetRemoveCachedPassword(
r = WN_ACCESS_DENIED; r = WN_ACCESS_DENIED;
else else
r = WN_SUCCESS; r = WN_SUCCESS;
HeapFree( GetProcessHeap(), 0, valname ); free( valname );
} }
else else
r = WN_OUT_OF_MEMORY; r = WN_OUT_OF_MEMORY;
...@@ -209,7 +209,7 @@ DWORD WINAPI WNetGetCachedPassword( ...@@ -209,7 +209,7 @@ DWORD WINAPI WNetGetCachedPassword(
r = WN_CANCEL; r = WN_CANCEL;
else else
r = WN_SUCCESS; r = WN_SUCCESS;
HeapFree( GetProcessHeap(), 0, valname ); free( valname );
} }
else else
r = WN_OUT_OF_MEMORY; r = WN_OUT_OF_MEMORY;
...@@ -299,7 +299,7 @@ UINT WINAPI WNetEnumCachedPasswords( ...@@ -299,7 +299,7 @@ UINT WINAPI WNetEnumCachedPasswords(
/* read the value data */ /* read the value data */
size = offsetof( PASSWORD_CACHE_ENTRY, abResource[val_sz + data_sz] ); size = offsetof( PASSWORD_CACHE_ENTRY, abResource[val_sz + data_sz] );
entry = HeapAlloc( GetProcessHeap(), 0, size ); entry = malloc( size );
memcpy( entry->abResource, val, val_sz ); memcpy( entry->abResource, val, val_sz );
entry->cbEntry = size; entry->cbEntry = size;
entry->cbResource = val_sz; entry->cbResource = val_sz;
...@@ -311,7 +311,7 @@ UINT WINAPI WNetEnumCachedPasswords( ...@@ -311,7 +311,7 @@ UINT WINAPI WNetEnumCachedPasswords(
&entry->abResource[val_sz], &data_sz ); &entry->abResource[val_sz], &data_sz );
if( r == ERROR_SUCCESS ) if( r == ERROR_SUCCESS )
enumPasswordProc( entry, param ); enumPasswordProc( entry, param );
HeapFree( GetProcessHeap(), 0, entry ); free( entry );
} }
RegCloseKey( hkey ); RegCloseKey( hkey );
......
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