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