Do not check for non NULL pointer before HeapFree'ing it. It's

redundant.
This commit is contained in:
Michael Stefaniuc 2004-12-23 17:06:43 +00:00 committed by Alexandre Julliard
parent bf42021e06
commit 5ad7d858e0
162 changed files with 445 additions and 764 deletions

View File

@ -1006,7 +1006,7 @@ DWORD WINAPI RegSetValueExA( HKEY hkey, LPCSTR name, DWORD reserved, DWORD type,
{
status = NtSetValueKey( hkey, &NtCurrentTeb()->StaticUnicodeString, 0, type, data, count );
}
if (dataW) HeapFree( GetProcessHeap(), 0, dataW );
HeapFree( GetProcessHeap(), 0, dataW );
return RtlNtStatusToDosError( status );
}

View File

@ -1215,8 +1215,7 @@ GetFileSecurityA( LPCSTR lpFileName,
r = GetFileSecurityW( name, RequestedInformation, pSecurityDescriptor,
nLength, lpnLengthNeeded );
if( name )
HeapFree( GetProcessHeap(), 0, name );
HeapFree( GetProcessHeap(), 0, name );
return r;
}
@ -1332,8 +1331,7 @@ BOOL WINAPI SetFileSecurityA( LPCSTR lpFileName,
}
r = SetFileSecurityW( name, RequestedInformation, pSecurityDescriptor );
if( name )
HeapFree( GetProcessHeap(), 0, name );
HeapFree( GetProcessHeap(), 0, name );
return r;
}
@ -2017,8 +2015,7 @@ DWORD WINAPI SetNamedSecurityInfoA(LPSTR pObjectName,
r = SetNamedSecurityInfoW( wstr, ObjectType, SecurityInfo, psidOwner,
psidGroup, pDacl, pSacl );
if( wstr )
HeapFree( GetProcessHeap(), 0, wstr );
HeapFree( GetProcessHeap(), 0, wstr );
return r;
}
@ -2946,8 +2943,7 @@ DWORD WINAPI GetNamedSecurityInfoA(LPSTR pObjectName,
r = GetNamedSecurityInfoW( wstr, ObjectType, SecurityInfo, ppsidOwner,
ppsidGroup, ppDacl, ppSacl, ppSecurityDescriptor );
if( wstr )
HeapFree( GetProcessHeap(), 0, wstr );
HeapFree( GetProcessHeap(), 0, wstr );
return r;
}

View File

@ -358,7 +358,7 @@ static void dispose_service_thread_data( struct service_thread_data* thread_data
{
if( thread_data->mutex ) CloseHandle( thread_data->mutex );
if( thread_data->ack_event ) CloseHandle( thread_data->ack_event );
if( thread_data->argv ) HeapFree( GetProcessHeap(), 0, thread_data->argv );
HeapFree( GetProcessHeap(), 0, thread_data->argv );
if( thread_data->seb ) UnmapViewOfFile( thread_data->seb );
if( thread_data->hServiceShmem ) CloseHandle( thread_data->hServiceShmem );
HeapFree( GetProcessHeap(), 0, thread_data );

View File

@ -187,32 +187,20 @@ static void ANIMATE_Free(ANIMATE_INFO *infoPtr)
FreeResource(infoPtr->hRes);
infoPtr->hRes = 0;
}
if (infoPtr->lpIndex) {
HeapFree(GetProcessHeap(), 0, infoPtr->lpIndex);
infoPtr->lpIndex = NULL;
}
HeapFree(GetProcessHeap(), 0, infoPtr->lpIndex);
infoPtr->lpIndex = NULL;
if (infoPtr->hic) {
fnIC.fnICClose(infoPtr->hic);
infoPtr->hic = 0;
}
if (infoPtr->inbih) {
HeapFree(GetProcessHeap(), 0, infoPtr->inbih);
infoPtr->inbih = NULL;
}
if (infoPtr->outbih) {
HeapFree(GetProcessHeap(), 0, infoPtr->outbih);
infoPtr->outbih = NULL;
}
if( infoPtr->indata )
{
HeapFree(GetProcessHeap(), 0, infoPtr->inbih);
infoPtr->inbih = NULL;
HeapFree(GetProcessHeap(), 0, infoPtr->outbih);
infoPtr->outbih = NULL;
HeapFree(GetProcessHeap(), 0, infoPtr->indata);
infoPtr->indata = NULL;
}
if( infoPtr->outdata )
{
infoPtr->indata = NULL;
HeapFree(GetProcessHeap(), 0, infoPtr->outdata);
infoPtr->outdata = NULL;
}
infoPtr->outdata = NULL;
if( infoPtr->hbmPrevFrame )
{
DeleteObject(infoPtr->hbmPrevFrame);

View File

@ -115,14 +115,8 @@ static VOID SYSLINK_FreeDocItem (PDOC_ITEM DocItem)
{
if(DocItem->Type == slLink)
{
if(DocItem->u.Link.szID != NULL)
{
SYSLINK_Free(DocItem->u.Link.szID);
}
if(DocItem->u.Link.szUrl != NULL)
{
SYSLINK_Free(DocItem->u.Link.szUrl);
}
SYSLINK_Free(DocItem->u.Link.szID);
SYSLINK_Free(DocItem->u.Link.szUrl);
}
if(DocItem->Type == slLink && DocItem->u.Link.hRgn != NULL)

View File

@ -5522,8 +5522,7 @@ TOOLBAR_Destroy (HWND hwnd, WPARAM wParam, LPARAM lParam)
DestroyWindow (infoPtr->hwndToolTip);
/* delete temporary buffer for tooltip text */
if (infoPtr->pszTooltipText)
HeapFree(GetProcessHeap(), 0, infoPtr->pszTooltipText);
HeapFree(GetProcessHeap(), 0, infoPtr->pszTooltipText);
/* delete button data */
if (infoPtr->buttons)
@ -6275,11 +6274,8 @@ static LRESULT TOOLBAR_TTGetDispInfo (TOOLBAR_INFO *infoPtr, NMTTDISPINFOW *lpnm
TRACE("button index = %d\n", index);
if (infoPtr->pszTooltipText)
{
HeapFree(GetProcessHeap(), 0, infoPtr->pszTooltipText);
infoPtr->pszTooltipText = NULL;
}
HeapFree(GetProcessHeap(), 0, infoPtr->pszTooltipText);
infoPtr->pszTooltipText = NULL;
if (index < 0)
return 0;

View File

@ -3358,10 +3358,7 @@ static void *MemAlloc(UINT size)
static void MemFree(void *mem)
{
if(mem)
{
HeapFree(GetProcessHeap(),0,mem);
}
HeapFree(GetProcessHeap(),0,mem);
}
/*

View File

@ -757,12 +757,12 @@ void FD31_MapOfnStructA(LPOPENFILENAMEA ofnA, LPOPENFILENAMEW ofnW, BOOL open)
*/
void FD31_FreeOfnW(LPOPENFILENAMEW ofnW)
{
if (ofnW->lpstrFilter) HeapFree(GetProcessHeap(), 0, (LPWSTR) ofnW->lpstrFilter);
if (ofnW->lpstrCustomFilter) HeapFree(GetProcessHeap(), 0, ofnW->lpstrCustomFilter);
if (ofnW->lpstrFile) HeapFree(GetProcessHeap(), 0, ofnW->lpstrFile);
if (ofnW->lpstrFileTitle) HeapFree(GetProcessHeap(), 0, ofnW->lpstrFileTitle);
if (ofnW->lpstrInitialDir) HeapFree(GetProcessHeap(), 0, (LPWSTR) ofnW->lpstrInitialDir);
if (ofnW->lpstrTitle) HeapFree(GetProcessHeap(), 0, (LPWSTR) ofnW->lpstrTitle);
HeapFree(GetProcessHeap(), 0, (LPWSTR) ofnW->lpstrFilter);
HeapFree(GetProcessHeap(), 0, ofnW->lpstrCustomFilter);
HeapFree(GetProcessHeap(), 0, ofnW->lpstrFile);
HeapFree(GetProcessHeap(), 0, ofnW->lpstrFileTitle);
HeapFree(GetProcessHeap(), 0, (LPWSTR) ofnW->lpstrInitialDir);
HeapFree(GetProcessHeap(), 0, (LPWSTR) ofnW->lpstrTitle);
if ((ofnW->lpTemplateName) && (HIWORD(ofnW->lpTemplateName)))
HeapFree(GetProcessHeap(), 0, (LPWSTR) ofnW->lpTemplateName);
}

View File

@ -1045,8 +1045,7 @@ LRESULT CFn_WMDestroy(HWND hwnd, WPARAM wParam, LPARAM lParam, LPCHOOSEFONTW lpc
HeapFree(GetProcessHeap(), 0, lpcfw->lpszStyle);
}
if(lpcfw->lpTemplateName)
HeapFree(GetProcessHeap(), 0, (LPBYTE)lpcfw->lpTemplateName);
HeapFree(GetProcessHeap(), 0, (LPBYTE)lpcfw->lpTemplateName);
HeapFree(GetProcessHeap(), 0, lpcfw->lpLogFont);
HeapFree(GetProcessHeap(), 0, lpcfw);

View File

@ -280,10 +280,8 @@ BOOL16 WINAPI ChooseFont16(LPCHOOSEFONT16 lpChFont)
WideCharToMultiByte(CP_ACP, 0, cf32w.lpLogFont->lfFaceName,
LF_FACESIZE, font16->lfFaceName, LF_FACESIZE, 0, 0);
if(cf32w.lpTemplateName)
HeapFree(GetProcessHeap(), 0, (LPBYTE)cf32w.lpTemplateName);
if(cf32w.lpszStyle)
HeapFree(GetProcessHeap(), 0, cf32w.lpszStyle);
HeapFree(GetProcessHeap(), 0, (LPBYTE)cf32w.lpTemplateName);
HeapFree(GetProcessHeap(), 0, cf32w.lpszStyle);
return bRet;
}

View File

@ -479,8 +479,8 @@ static BOOL PRINTDLG_PaperSizeA(
out:
GlobalUnlock(pdlga->hDevNames);
GlobalUnlock(pdlga->hDevMode);
if (Names) HeapFree(GetProcessHeap(),0,Names);
if (points) HeapFree(GetProcessHeap(),0,points);
HeapFree(GetProcessHeap(),0,Names);
HeapFree(GetProcessHeap(),0,points);
return retval;
}
@ -537,8 +537,8 @@ static BOOL PRINTDLG_PaperSizeW(
out:
GlobalUnlock(pdlga->hDevNames);
GlobalUnlock(pdlga->hDevMode);
if (Names) HeapFree(GetProcessHeap(),0,Names);
if (points) HeapFree(GetProcessHeap(),0,points);
HeapFree(GetProcessHeap(),0,Names);
HeapFree(GetProcessHeap(),0,points);
return retval;
}
@ -860,10 +860,8 @@ BOOL PRINTDLG_ChangePrinterA(HWND hDlg, char *name,
DWORD needed;
HANDLE hprn;
if(PrintStructures->lpPrinterInfo)
HeapFree(GetProcessHeap(),0, PrintStructures->lpPrinterInfo);
if(PrintStructures->lpDriverInfo)
HeapFree(GetProcessHeap(),0, PrintStructures->lpDriverInfo);
HeapFree(GetProcessHeap(),0, PrintStructures->lpPrinterInfo);
HeapFree(GetProcessHeap(),0, PrintStructures->lpDriverInfo);
if(!OpenPrinterA(name, &hprn, NULL)) {
ERR("Can't open printer %s\n", name);
return FALSE;
@ -883,10 +881,8 @@ BOOL PRINTDLG_ChangePrinterA(HWND hDlg, char *name,
PRINTDLG_UpdatePrinterInfoTextsA(hDlg, PrintStructures->lpPrinterInfo);
if(PrintStructures->lpDevMode) {
HeapFree(GetProcessHeap(), 0, PrintStructures->lpDevMode);
PrintStructures->lpDevMode = NULL;
}
HeapFree(GetProcessHeap(), 0, PrintStructures->lpDevMode);
PrintStructures->lpDevMode = NULL;
dmSize = DocumentPropertiesA(0, 0, name, NULL, NULL, 0);
if(dmSize == -1) {
@ -1013,10 +1009,8 @@ static BOOL PRINTDLG_ChangePrinterW(HWND hDlg, WCHAR *name,
DWORD needed;
HANDLE hprn;
if(PrintStructures->lpPrinterInfo)
HeapFree(GetProcessHeap(),0, PrintStructures->lpPrinterInfo);
if(PrintStructures->lpDriverInfo)
HeapFree(GetProcessHeap(),0, PrintStructures->lpDriverInfo);
HeapFree(GetProcessHeap(),0, PrintStructures->lpPrinterInfo);
HeapFree(GetProcessHeap(),0, PrintStructures->lpDriverInfo);
if(!OpenPrinterW(name, &hprn, NULL)) {
ERR("Can't open printer %s\n", debugstr_w(name));
return FALSE;
@ -1036,10 +1030,8 @@ static BOOL PRINTDLG_ChangePrinterW(HWND hDlg, WCHAR *name,
PRINTDLG_UpdatePrinterInfoTextsW(hDlg, PrintStructures->lpPrinterInfo);
if(PrintStructures->lpDevMode) {
HeapFree(GetProcessHeap(), 0, PrintStructures->lpDevMode);
PrintStructures->lpDevMode = NULL;
}
HeapFree(GetProcessHeap(), 0, PrintStructures->lpDevMode);
PrintStructures->lpDevMode = NULL;
dmSize = DocumentPropertiesW(0, 0, name, NULL, NULL, 0);
if(dmSize == -1) {

View File

@ -4055,7 +4055,7 @@ HRESULT WINAPI IDirect3DDevice8Impl_DeleteVertexShader(LPDIRECT3DDEVICE8 iface
}
TRACE_(d3d_shader)("(%p) : freing VertexShader %p\n", This, object);
/* TODO: check validity of object */
if (NULL != object->function) HeapFree(GetProcessHeap(), 0, (void *)object->function);
HeapFree(GetProcessHeap(), 0, (void *)object->function);
if (object->prgId != 0) {
GL_EXTCALL(glDeleteProgramsARB( 1, &object->prgId ));
}
@ -4240,7 +4240,7 @@ HRESULT WINAPI IDirect3DDevice8Impl_DeletePixelShader(LPDIRECT3DDEVICE8 iface,
}
TRACE_(d3d_shader)("(%p) : freeing PixelShader %p\n", This, object);
/* TODO: check validity of object before free */
if (NULL != object->function) HeapFree(GetProcessHeap(), 0, (void *)object->function);
HeapFree(GetProcessHeap(), 0, (void *)object->function);
if (object->prgId != 0) {
GL_EXTCALL(glDeleteProgramsARB( 1, &object->prgId ));
}

View File

@ -389,7 +389,7 @@ HRESULT WINAPI IDirect3DDeviceImpl_DeleteStateBlock(IDirect3DDevice8Impl* This,
HeapFree(GetProcessHeap(), 0, (void *)(tmp->prev));
tmp = tmp->next;
}
if (tmp) HeapFree(GetProcessHeap(), 0, (void *)tmp);
HeapFree(GetProcessHeap(), 0, (void *)tmp);
HeapFree(GetProcessHeap(), 0, (void *)pSB);
return D3D_OK;
}

View File

@ -60,7 +60,7 @@ ULONG WINAPI IDirect3DVertexBuffer8Impl_Release(LPDIRECT3DVERTEXBUFFER8 iface) {
ULONG ref = --This->ref;
TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref);
if (ref == 0) {
if (NULL != This->allocatedMemory) HeapFree(GetProcessHeap(), 0, This->allocatedMemory);
HeapFree(GetProcessHeap(), 0, This->allocatedMemory);
HeapFree(GetProcessHeap(), 0, This);
}
return ref;

View File

@ -60,7 +60,7 @@ ULONG WINAPI ID3DXBufferImpl_Release(LPD3DXBUFFER iface) {
ULONG ref = --This->ref;
TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref);
if (ref == 0) {
if (NULL != This->buffer) HeapFree(GetProcessHeap(), 0, This->buffer);
HeapFree(GetProcessHeap(), 0, This->buffer);
HeapFree(GetProcessHeap(), 0, This);
}
return ref;

View File

@ -378,8 +378,7 @@ static void codeview_clear_type_table(void)
cv_zmodules[i].allowed = FALSE;
cv_zmodules[i].defined_types = NULL;
cv_zmodules[i].num_defined_types = 0;
if (cv_zmodules[i].bitfields)
HeapFree(GetProcessHeap(), 0, cv_zmodules[i].bitfields);
HeapFree(GetProcessHeap(), 0, cv_zmodules[i].bitfields);
cv_zmodules[i].bitfields = NULL;
cv_zmodules[i].num_bitfields = cv_zmodules[i].used_bitfields = 0;
}
@ -1542,7 +1541,7 @@ static int codeview_snarf(const struct msc_debug_info* msc_dbg, const BYTE* root
if (curr_func) symt_normalize_function(msc_dbg->module, curr_func);
if (linetab) HeapFree(GetProcessHeap(), 0, linetab);
HeapFree(GetProcessHeap(), 0, linetab);
return TRUE;
}

View File

@ -1474,7 +1474,7 @@ BOOL stabs_parse(struct module* module, unsigned long load_offset,
done:
HeapFree(GetProcessHeap(), 0, stabbuff);
stabs_free_includes();
if (pending_vars) HeapFree(GetProcessHeap(), 0, pending_vars);
HeapFree(GetProcessHeap(), 0, pending_vars);
return ret;
}

View File

@ -110,8 +110,7 @@ static void execute(IDirect3DExecuteBufferImpl *This,
if (count*3>This->nb_indices) {
This->nb_indices = count * 3;
if (This->indices)
HeapFree(GetProcessHeap(),0,This->indices);
HeapFree(GetProcessHeap(),0,This->indices);
This->indices = HeapAlloc(GetProcessHeap(),0,sizeof(WORD)*This->nb_indices);
}
@ -532,10 +531,8 @@ Main_IDirect3DExecuteBufferImpl_1_Release(LPDIRECT3DEXECUTEBUFFER iface)
if (!--(This->ref)) {
if ((This->desc.lpData != NULL) && This->need_free)
HeapFree(GetProcessHeap(),0,This->desc.lpData);
if (This->vertex_data != NULL)
HeapFree(GetProcessHeap(),0,This->vertex_data);
if (This->indices != NULL)
HeapFree(GetProcessHeap(),0,This->indices);
HeapFree(GetProcessHeap(),0,This->vertex_data);
HeapFree(GetProcessHeap(),0,This->indices);
HeapFree(GetProcessHeap(),0,This);
return 0;
}
@ -594,8 +591,7 @@ Main_IDirect3DExecuteBufferImpl_1_SetExecuteData(LPDIRECT3DEXECUTEBUFFER iface,
nbvert = This->data.dwVertexCount;
/* Prepares the transformed vertex buffer */
if (This->vertex_data != NULL)
HeapFree(GetProcessHeap(), 0, This->vertex_data);
HeapFree(GetProcessHeap(), 0, This->vertex_data);
This->vertex_data = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, nbvert * sizeof(D3DTLVERTEX));
if (TRACE_ON(ddraw)) {

View File

@ -577,8 +577,7 @@ gltex_final_release(IDirectDrawSurfaceImpl *This)
glDeleteTextures(1, &(glThis->tex_name));
LEAVE_GL();
if (glThis->surface_ptr != NULL)
HeapFree(GetProcessHeap(), 0, glThis->surface_ptr);
HeapFree(GetProcessHeap(), 0, glThis->surface_ptr);
/* And if this texture was the current one, remove it at the device level */
if (This->d3ddevice != NULL)

View File

@ -198,8 +198,7 @@ static HRESULT WINAPI DEVENUM_IPropertyBag_Read(
FIXME("Variant type %x not supported for regtype %lx\n", V_VT(pVar), type);
}
if (pData)
HeapFree(GetProcessHeap(), 0, pData);
HeapFree(GetProcessHeap(), 0, pData);
TRACE("<- %lx\n", res);
return res;

View File

@ -580,18 +580,12 @@ static HRESULT alloc_device(REFGUID rguid, LPVOID jvt, IDirectInputImpl *dinput,
FAILED:
hr = DIERR_OUTOFMEMORY;
FAILED1:
if (newDevice->axis_map)
HeapFree(GetProcessHeap(),0,newDevice->axis_map);
if (newDevice->name)
HeapFree(GetProcessHeap(),0,newDevice->name);
if (newDevice->props)
HeapFree(GetProcessHeap(),0,newDevice->props);
if (newDevice->user_df->rgodf)
HeapFree(GetProcessHeap(),0,newDevice->user_df->rgodf);
if (newDevice->user_df)
HeapFree(GetProcessHeap(),0,newDevice->user_df);
if (newDevice)
HeapFree(GetProcessHeap(),0,newDevice);
HeapFree(GetProcessHeap(),0,newDevice->axis_map);
HeapFree(GetProcessHeap(),0,newDevice->name);
HeapFree(GetProcessHeap(),0,newDevice->props);
HeapFree(GetProcessHeap(),0,newDevice->user_df->rgodf);
HeapFree(GetProcessHeap(),0,newDevice->user_df);
HeapFree(GetProcessHeap(),0,newDevice);
*pdev = 0;
return hr;
@ -676,16 +670,13 @@ static ULONG WINAPI JoystickAImpl_Release(LPDIRECTINPUTDEVICE8A iface)
return ref;
/* Free the device name */
if (This->name)
HeapFree(GetProcessHeap(),0,This->name);
HeapFree(GetProcessHeap(),0,This->name);
/* Free the axis map */
if (This->axis_map)
HeapFree(GetProcessHeap(),0,This->axis_map);
HeapFree(GetProcessHeap(),0,This->axis_map);
/* Free the data queue */
if (This->data_queue != NULL)
HeapFree(GetProcessHeap(),0,This->data_queue);
HeapFree(GetProcessHeap(),0,This->data_queue);
/* Free the DataFormat */
HeapFree(GetProcessHeap(), 0, This->user_df->rgodf);
@ -769,12 +760,9 @@ static HRESULT WINAPI JoystickAImpl_SetDataFormat(
FAILED:
WARN("out of memory\n");
if (new_props)
HeapFree(GetProcessHeap(),0,new_props);
if (new_rgodf)
HeapFree(GetProcessHeap(),0,new_rgodf);
if (new_df)
HeapFree(GetProcessHeap(),0,new_df);
HeapFree(GetProcessHeap(),0,new_props);
HeapFree(GetProcessHeap(),0,new_rgodf);
HeapFree(GetProcessHeap(),0,new_df);
return DIERR_OUTOFMEMORY;
}

View File

@ -346,8 +346,7 @@ static ULONG WINAPI JoystickAImpl_Release(LPDIRECTINPUTDEVICE8A iface)
return ref;
/* Free the data queue */
if (This->data_queue != NULL)
HeapFree(GetProcessHeap(),0,This->data_queue);
HeapFree(GetProcessHeap(),0,This->data_queue);
/* Free the DataFormat */
HeapFree(GetProcessHeap(), 0, This->df);

View File

@ -317,8 +317,7 @@ static ULONG WINAPI SysKeyboardAImpl_Release(LPDIRECTINPUTDEVICE8A iface)
LeaveCriticalSection(&keyboard_crit);
/* Free the data queue */
if (This->buffer != NULL)
HeapFree(GetProcessHeap(),0,This->buffer);
HeapFree(GetProcessHeap(),0,This->buffer);
DeleteCriticalSection(&(This->crit));

View File

@ -333,8 +333,7 @@ static ULONG WINAPI SysMouseAImpl_Release(LPDIRECTINPUTDEVICE8A iface)
return ref;
/* Free the data queue */
if (This->data_queue != NULL)
HeapFree(GetProcessHeap(),0,This->data_queue);
HeapFree(GetProcessHeap(),0,This->data_queue);
if (This->hook) {
UnhookWindowsHookEx( This->hook );

View File

@ -72,10 +72,10 @@ ULONG WINAPI IDirectMusicScriptImpl_IUnknown_Release (LPUNKNOWN iface) {
ULONG ref = --This->ref;
TRACE("(%p): ReleaseRef to %ld\n", This, This->ref);
if (ref == 0) {
if (NULL != This->pHeader) HeapFree(GetProcessHeap(), 0, This->pHeader);
if (NULL != This->pVersion) HeapFree(GetProcessHeap(), 0, This->pVersion);
if (NULL != This->pwzLanguage) HeapFree(GetProcessHeap(), 0, This->pwzLanguage);
if (NULL != This->pwzSource) HeapFree(GetProcessHeap(), 0, This->pwzSource);
HeapFree(GetProcessHeap(), 0, This->pHeader);
HeapFree(GetProcessHeap(), 0, This->pVersion);
HeapFree(GetProcessHeap(), 0, This->pwzLanguage);
HeapFree(GetProcessHeap(), 0, This->pwzSource);
HeapFree(GetProcessHeap(), 0, This);
}
return ref;

View File

@ -1307,15 +1307,8 @@ static BOOL DP_CopyDPNAMEStruct( LPDPNAME lpDst, LPDPNAME lpSrc, BOOL bAnsi )
}
/* Delete any existing pointers */
if( lpDst->u1.lpszShortNameA )
{
HeapFree( GetProcessHeap(), 0, lpDst->u1.lpszShortNameA );
}
if( lpDst->u2.lpszLongNameA )
{
HeapFree( GetProcessHeap(), 0, lpDst->u1.lpszShortNameA );
}
HeapFree( GetProcessHeap(), 0, lpDst->u1.lpszShortNameA );
HeapFree( GetProcessHeap(), 0, lpDst->u2.lpszLongNameA );
/* Copy as required */
CopyMemory( lpDst, lpSrc, lpSrc->dwSize );

View File

@ -411,21 +411,13 @@ static HRESULT WINAPI IDirectPlaySPImpl_GetSPPlayerData
/* What to do in the case where there is nothing set yet? */
if( dwFlags == DPSET_LOCAL )
{
if( lpPlayerData->lpPlayerLocalData )
{
HeapFree( GetProcessHeap(), 0, lpPlayerData->lpPlayerLocalData );
}
HeapFree( GetProcessHeap(), 0, lpPlayerData->lpPlayerLocalData );
*lplpData = lpPlayerData->lpPlayerLocalData;
*lpdwDataSize = lpPlayerData->dwPlayerLocalDataSize;
}
else if( dwFlags == DPSET_REMOTE )
{
if( lpPlayerData->lpPlayerRemoteData )
{
HeapFree( GetProcessHeap(), 0, lpPlayerData->lpPlayerRemoteData );
}
HeapFree( GetProcessHeap(), 0, lpPlayerData->lpPlayerRemoteData );
*lplpData = lpPlayerData->lpPlayerRemoteData;
*lpdwDataSize = lpPlayerData->dwPlayerRemoteDataSize;
}
@ -908,21 +900,13 @@ static HRESULT WINAPI IDirectPlaySPImpl_SetSPData
/* If we have data already allocated, free it and replace it */
if( dwFlags == DPSET_REMOTE )
{
if( This->sp->lpSpRemoteData )
{
HeapFree( GetProcessHeap(), 0, This->sp->lpSpRemoteData );
}
HeapFree( GetProcessHeap(), 0, This->sp->lpSpRemoteData );
This->sp->dwSpRemoteDataSize = dwDataSize;
This->sp->lpSpRemoteData = lpSpData;
}
else if ( dwFlags == DPSET_LOCAL )
{
if( This->sp->lpSpLocalData )
{
HeapFree( GetProcessHeap(), 0, This->sp->lpSpLocalData );
}
HeapFree( GetProcessHeap(), 0, This->sp->lpSpLocalData );
This->sp->lpSpLocalData = lpSpData;
This->sp->dwSpLocalDataSize = dwDataSize;
}

View File

@ -132,10 +132,8 @@ static HRESULT WINAPI IDirectSoundNotifyImpl_SetNotificationPositions(
memcpy(This->dsb->notifies, notify, howmuch * sizeof(DSBPOSITIONNOTIFY));
This->dsb->nrofnotifies = howmuch;
} else {
if (This->dsb->notifies) {
HeapFree(GetProcessHeap(), 0, This->dsb->notifies);
This->dsb->notifies = NULL;
}
HeapFree(GetProcessHeap(), 0, This->dsb->notifies);
This->dsb->notifies = NULL;
This->dsb->nrofnotifies = 0;
}
@ -406,12 +404,8 @@ static ULONG WINAPI IDirectSoundBufferImpl_Release(LPDIRECTSOUNDBUFFER8 iface)
}
}
if (This->notifies != NULL)
HeapFree(GetProcessHeap(), 0, This->notifies);
if (This->pwfx)
HeapFree(GetProcessHeap(), 0, This->pwfx);
HeapFree(GetProcessHeap(), 0, This->notifies);
HeapFree(GetProcessHeap(), 0, This->pwfx);
HeapFree(GetProcessHeap(),0,This);
TRACE("(%p) released\n",This);
@ -1207,10 +1201,8 @@ HRESULT WINAPI IDirectSoundBufferImpl_Create(
if (!(dsbd->dwFlags & DSBCAPS_PRIMARYBUFFER)) {
err = DSOUND_AddBuffer(ds, dsb);
if (err != DS_OK) {
if (dsb->buffer->memory)
HeapFree(GetProcessHeap(),0,dsb->buffer->memory);
if (dsb->buffer)
HeapFree(GetProcessHeap(),0,dsb->buffer);
HeapFree(GetProcessHeap(),0,dsb->buffer->memory);
HeapFree(GetProcessHeap(),0,dsb->buffer);
dsb->lock.DebugInfo->Spare[1] = 0;
DeleteCriticalSection(&(dsb->lock));
HeapFree(GetProcessHeap(),0,dsb->pwfx);

View File

@ -397,9 +397,7 @@ IDirectSoundCaptureImpl_Release( LPDIRECTSOUNDCAPTURE iface )
IDsCaptureDriver_Release(This->driver);
}
if (This->pwfx)
HeapFree(GetProcessHeap(), 0, This->pwfx);
HeapFree(GetProcessHeap(), 0, This->pwfx);
This->lock.DebugInfo->Spare[1] = 0;
DeleteCriticalSection( &(This->lock) );
HeapFree( GetProcessHeap(), 0, This );
@ -730,8 +728,7 @@ DSOUND_CreateDirectSoundCaptureBuffer(
/* let driver allocate memory */
ipDSC->buflen = lpcDSCBufferDesc->dwBufferBytes;
/* FIXME: */
if (ipDSC->buffer)
HeapFree( GetProcessHeap(), 0, ipDSC->buffer);
HeapFree( GetProcessHeap(), 0, ipDSC->buffer);
ipDSC->buffer = NULL;
}
@ -868,10 +865,8 @@ static HRESULT WINAPI IDirectSoundCaptureNotifyImpl_SetNotificationPositions(
memcpy(This->dscb->notifies, notify, howmuch * sizeof(DSBPOSITIONNOTIFY));
This->dscb->nrofnotifies = howmuch;
} else {
if (This->dscb->notifies) {
HeapFree(GetProcessHeap(), 0, This->dscb->notifies);
This->dscb->notifies = NULL;
}
HeapFree(GetProcessHeap(), 0, This->dscb->notifies);
This->dscb->notifies = NULL;
This->dscb->nrofnotifies = 0;
}
@ -985,16 +980,13 @@ IDirectSoundCaptureBufferImpl_Release( LPDIRECTSOUNDCAPTUREBUFFER8 iface )
if (This->dsound->state == STATE_CAPTURING)
This->dsound->state = STATE_STOPPING;
if (This->pdscbd)
HeapFree(GetProcessHeap(),0, This->pdscbd);
HeapFree(GetProcessHeap(),0, This->pdscbd);
if (This->dsound->hwi) {
waveInReset(This->dsound->hwi);
waveInClose(This->dsound->hwi);
if (This->dsound->pwave) {
HeapFree(GetProcessHeap(),0, This->dsound->pwave);
This->dsound->pwave = 0;
}
HeapFree(GetProcessHeap(),0, This->dsound->pwave);
This->dsound->pwave = 0;
This->dsound->hwi = 0;
}
@ -1010,9 +1002,7 @@ IDirectSoundCaptureBufferImpl_Release( LPDIRECTSOUNDCAPTUREBUFFER8 iface )
if (This->notify)
IDirectSoundNotify_Release((LPDIRECTSOUNDNOTIFY)This->notify);
if (This->notifies != NULL)
HeapFree(GetProcessHeap(), 0, This->notifies);
HeapFree(GetProcessHeap(), 0, This->notifies);
HeapFree( GetProcessHeap(), 0, This );
TRACE("(%p) released\n",This);
}

View File

@ -234,10 +234,8 @@ HRESULT DSOUND_PrimaryDestroy(IDirectSoundImpl *This)
HeapFree(GetProcessHeap(),0,This->pwave[c]);
}
}
if (This->pwfx) {
HeapFree(GetProcessHeap(),0,This->pwfx);
This->pwfx=NULL;
}
HeapFree(GetProcessHeap(),0,This->pwfx);
This->pwfx=NULL;
return DS_OK;
}

View File

@ -532,8 +532,7 @@ static BOOL BITMAP_DeleteObject( HGDIOBJ handle, void *obj )
if (bmp->funcs && bmp->funcs->pDeleteBitmap)
bmp->funcs->pDeleteBitmap( handle );
if( bmp->bitmap.bmBits )
HeapFree( GetProcessHeap(), 0, bmp->bitmap.bmBits );
HeapFree( GetProcessHeap(), 0, bmp->bitmap.bmBits );
if (bmp->dib)
{

View File

@ -651,7 +651,7 @@ HDC WINAPI CreateDCA( LPCSTR driver, LPCSTR device, LPCSTR output,
RtlFreeUnicodeString(&driverW);
RtlFreeUnicodeString(&deviceW);
RtlFreeUnicodeString(&outputW);
if (initDataW) HeapFree(GetProcessHeap(), 0, initDataW);
HeapFree(GetProcessHeap(), 0, initDataW);
return ret;
}
@ -825,7 +825,7 @@ HDC WINAPI ResetDCA( HDC hdc, const DEVMODEA *devmode )
ret = ResetDCW(hdc, devmodeW);
if (devmodeW) HeapFree(GetProcessHeap(), 0, devmodeW);
HeapFree(GetProcessHeap(), 0, devmodeW);
return ret;
}

View File

@ -629,7 +629,7 @@ INT WINAPI Escape( HDC hdc, INT escape, INT in_count, LPCSTR in_data, LPVOID out
}
doc.lpszDocName = name;
ret = StartDocA( hdc, &doc );
if (name) HeapFree( GetProcessHeap(), 0, name );
HeapFree( GetProcessHeap(), 0, name );
if (ret > 0) ret = StartPage( hdc );
return ret;
}

View File

@ -1677,7 +1677,7 @@ BOOL WINAPI ExtTextOutA( HDC hdc, INT x, INT y, UINT flags,
ret = ExtTextOutW( hdc, x, y, flags, lprect, p, wlen, lpDxW );
HeapFree( GetProcessHeap(), 0, p );
if (lpDxW) HeapFree( GetProcessHeap(), 0, lpDxW );
HeapFree( GetProcessHeap(), 0, lpDxW );
return ret;
}
@ -1922,8 +1922,7 @@ DWORD WINAPI GetGlyphOutlineA( HDC hdc, UINT uChar, UINT fuFormat,
c = uChar;
ret = GetGlyphOutlineW(hdc, c, fuFormat, lpgm, cbBuffer, lpBuffer,
lpmat2);
if(p)
HeapFree(GetProcessHeap(), 0, p);
HeapFree(GetProcessHeap(), 0, p);
return ret;
}

View File

@ -1210,8 +1210,8 @@ BOOL WineEngInit(void)
vlen = valuelen;
}
}
if (data) HeapFree(GetProcessHeap(), 0, data);
if (valueW) HeapFree(GetProcessHeap(), 0, valueW);
HeapFree(GetProcessHeap(), 0, data);
HeapFree(GetProcessHeap(), 0, valueW);
RegCloseKey(hkey);
}
@ -1387,8 +1387,8 @@ static GdiFont alloc_font(void)
static void free_font(GdiFont font)
{
if (font->ft_face) pFT_Done_Face(font->ft_face);
if (font->potm) HeapFree(GetProcessHeap(), 0, font->potm);
if (font->name) HeapFree(GetProcessHeap(), 0, font->name);
HeapFree(GetProcessHeap(), 0, font->potm);
HeapFree(GetProcessHeap(), 0, font->name);
HeapFree(GetProcessHeap(), 0, font->gm);
HeapFree(GetProcessHeap(), 0, font);
}

View File

@ -1870,7 +1870,7 @@ BOOL16 WINAPI ExtTextOut16( HDC16 hdc, INT16 x, INT16 y, UINT16 flags,
rect32.bottom = lprect->bottom;
}
ret = ExtTextOutA(HDC_32(hdc),x,y,flags,lprect?&rect32:NULL,str,count,lpdx32);
if (lpdx32) HeapFree( GetProcessHeap(), 0, lpdx32 );
HeapFree( GetProcessHeap(), 0, lpdx32 );
return ret;
}

View File

@ -794,7 +794,7 @@ BOOL WINAPI EnumMetaFile(
/* free handle table */
HeapFree( GetProcessHeap(), 0, ht);
/* free a copy of metafile */
if (mhTemp) HeapFree( GetProcessHeap(), 0, mhTemp );
HeapFree( GetProcessHeap(), 0, mhTemp );
return result;
}

View File

@ -210,7 +210,7 @@ static BOOL MFDRV_DeleteDC( PHYSDEV dev )
DC *dc = physDev->dc;
DWORD index;
if (physDev->mh) HeapFree( GetProcessHeap(), 0, physDev->mh );
HeapFree( GetProcessHeap(), 0, physDev->mh );
for(index = 0; index < physDev->handles_size; index++)
if(physDev->handles[index])
GDI_hdc_not_using_object(physDev->handles[index], physDev->hdc);

View File

@ -150,6 +150,6 @@ MFDRV_ExtTextOut( PHYSDEV dev, INT x, INT y, UINT flags,
ret = MFDRV_MetaExtTextOut(dev,x,y,flags,lprect?&rect16:NULL,ascii,len,lpdx16);
HeapFree( GetProcessHeap(), 0, ascii );
if (lpdx16) HeapFree( GetProcessHeap(), 0, lpdx16 );
HeapFree( GetProcessHeap(), 0, lpdx16 );
return ret;
}

View File

@ -696,11 +696,9 @@ static BOOL PALETTE_UnrealizeObject( HGDIOBJ handle, void *obj )
{
PALETTEOBJ *palette = obj;
if (palette->mapping)
{
HeapFree( GetProcessHeap(), 0, palette->mapping );
palette->mapping = NULL;
}
HeapFree( GetProcessHeap(), 0, palette->mapping );
palette->mapping = NULL;
if (hLastRealizedPalette == handle)
{
TRACE("unrealizing palette %p\n", handle);

View File

@ -500,8 +500,8 @@ void PATH_DestroyGdiPath(GdiPath *pPath)
{
assert(pPath!=NULL);
if (pPath->pPoints) HeapFree( GetProcessHeap(), 0, pPath->pPoints );
if (pPath->pFlags) HeapFree( GetProcessHeap(), 0, pPath->pFlags );
HeapFree( GetProcessHeap(), 0, pPath->pPoints );
HeapFree( GetProcessHeap(), 0, pPath->pFlags );
}
/* PATH_AssignGdiPath

View File

@ -105,12 +105,9 @@ INT WINAPI StartDocW(HDC hdc, const DOCINFOW* doc)
ret = StartDocA(hdc, &docA);
if(docA.lpszDocName)
HeapFree( GetProcessHeap(), 0, (LPSTR)docA.lpszDocName );
if(docA.lpszOutput)
HeapFree( GetProcessHeap(), 0, (LPSTR)docA.lpszOutput );
if(docA.lpszDatatype)
HeapFree( GetProcessHeap(), 0, (LPSTR)docA.lpszDatatype );
HeapFree( GetProcessHeap(), 0, (LPSTR)docA.lpszDocName );
HeapFree( GetProcessHeap(), 0, (LPSTR)docA.lpszOutput );
HeapFree( GetProcessHeap(), 0, (LPSTR)docA.lpszDatatype );
return ret;
}

View File

@ -1282,11 +1282,8 @@ BOOL WINAPI ImmSetCompositionStringA(
rc = ImmSetCompositionStringW(hIMC, dwIndex, CompBuffer, comp_len,
ReadBuffer, read_len);
if (CompBuffer)
HeapFree(GetProcessHeap(), 0, CompBuffer);
if (ReadBuffer)
HeapFree(GetProcessHeap(), 0, ReadBuffer);
HeapFree(GetProcessHeap(), 0, CompBuffer);
HeapFree(GetProcessHeap(), 0, ReadBuffer);
return rc;
}

View File

@ -152,10 +152,8 @@ void interfaceMapInit(void)
void interfaceMapFree(void)
{
DeleteCriticalSection(&mapCS);
if (gNonLoopbackInterfaceMap)
HeapFree(GetProcessHeap(), 0, gNonLoopbackInterfaceMap);
if (gLoopbackInterfaceMap)
HeapFree(GetProcessHeap(), 0, gLoopbackInterfaceMap);
HeapFree(GetProcessHeap(), 0, gNonLoopbackInterfaceMap);
HeapFree(GetProcessHeap(), 0, gLoopbackInterfaceMap);
}
/* Sizes the passed-in map to have enough space for numInterfaces interfaces.
@ -321,8 +319,7 @@ static void enumerateInterfaces(void)
guessedNumInterfaces = INITIAL_INTERFACES_ASSUMED;
else
guessedNumInterfaces *= 2;
if (ifc.ifc_buf)
HeapFree(GetProcessHeap(), 0, ifc.ifc_buf);
HeapFree(GetProcessHeap(), 0, ifc.ifc_buf);
ifc.ifc_len = sizeof(struct ifreq) * guessedNumInterfaces;
ifc.ifc_buf = (char *)HeapAlloc(GetProcessHeap(), 0, ifc.ifc_len);
ret = ioctl(fd, SIOCGIFCONF, &ifc);
@ -336,8 +333,7 @@ static void enumerateInterfaces(void)
LeaveCriticalSection(&mapCS);
}
if (ifc.ifc_buf)
HeapFree(GetProcessHeap(), 0, ifc.ifc_buf);
HeapFree(GetProcessHeap(), 0, ifc.ifc_buf);
close(fd);
}
}

View File

@ -2296,8 +2296,7 @@ BOOL WINAPI SetDefaultCommConfigA(
MultiByteToWideChar( CP_ACP, 0, lpszDevice, -1, lpDeviceW, len );
}
r = SetDefaultCommConfigW(lpDeviceW,lpCommConfig,dwSize);
if (lpDeviceW)
HeapFree( GetProcessHeap(), 0, lpDeviceW );
HeapFree( GetProcessHeap(), 0, lpDeviceW );
return r;
}

View File

@ -390,7 +390,7 @@ BOOL WINAPI WriteConsoleOutputA( HANDLE hConsoleOutput, const CHAR_INFO *lpBuffe
}
new_coord.X = new_coord.Y = 0;
ret = WriteConsoleOutputW( hConsoleOutput, ciw, new_size, new_coord, region );
if (ciw) HeapFree( GetProcessHeap(), 0, ciw );
HeapFree( GetProcessHeap(), 0, ciw );
return ret;
}
@ -1224,7 +1224,7 @@ BOOL WINAPI ReadConsoleW(HANDLE hConsoleInput, LPVOID lpBuffer,
{
if (!S_EditString || S_EditString[S_EditStrPos] == 0)
{
if (S_EditString) HeapFree(GetProcessHeap(), 0, S_EditString);
HeapFree(GetProcessHeap(), 0, S_EditString);
if (!(S_EditString = CONSOLE_Readline(hConsoleInput)))
return FALSE;
S_EditStrPos = 0;

View File

@ -229,11 +229,8 @@ static void WCEL_InsertChar(WCEL_Context* ctx, WCHAR c)
static void WCEL_FreeYank(WCEL_Context* ctx)
{
if (ctx->yanked)
{
HeapFree(GetProcessHeap(), 0, ctx->yanked);
ctx->yanked = NULL;
}
HeapFree(GetProcessHeap(), 0, ctx->yanked);
ctx->yanked = NULL;
}
static void WCEL_SaveYank(WCEL_Context* ctx, int beg, int end)
@ -310,7 +307,7 @@ static void WCEL_MoveToHist(WCEL_Context* ctx, int idx)
/* save current line edition for recall when needed (FIXME seems broken to me) */
if (ctx->histPos == ctx->histSize - 1)
{
if (ctx->histCurr) HeapFree(GetProcessHeap(), 0, ctx->histCurr);
HeapFree(GetProcessHeap(), 0, ctx->histCurr);
ctx->histCurr = HeapAlloc(GetProcessHeap(), 0, (ctx->len + 1) * sizeof(WCHAR));
memcpy(ctx->histCurr, ctx->line, (ctx->len + 1) * sizeof(WCHAR));
}
@ -865,6 +862,6 @@ WCHAR* CONSOLE_Readline(HANDLE hConsoleIn)
CONSOLE_AppendHistory(ctx.line);
CloseHandle(ctx.hConOut);
if (ctx.histCurr) HeapFree(GetProcessHeap(), 0, ctx.histCurr);
HeapFree(GetProcessHeap(), 0, ctx.histCurr);
return ctx.line;
}

View File

@ -325,7 +325,7 @@ DWORD WINAPI ExpandEnvironmentStringsA( LPCSTR src, LPSTR dst, DWORD count )
else ret = ExpandEnvironmentStringsW( us_src.Buffer, NULL, 0);
RtlFreeUnicodeString( &us_src );
if (dstW) HeapFree(GetProcessHeap(), 0, dstW);
HeapFree(GetProcessHeap(), 0, dstW);
return ret;
}

View File

@ -1518,7 +1518,7 @@ HANDLE WINAPI FindFirstFileExW( LPCWSTR filename, FINDEX_INFO_LEVELS level,
return (HANDLE)info;
error:
if (info) HeapFree( GetProcessHeap(), 0, info );
HeapFree( GetProcessHeap(), 0, info );
RtlFreeUnicodeString( &nt_name );
return INVALID_HANDLE_VALUE;
}

View File

@ -402,7 +402,7 @@ UINT16 WINAPI GetTempFileName16( BYTE drive, LPCSTR prefix, UINT16 unique,
ret = GetTempFileNameA( temppath, prefix16, unique, buffer );
if (prefix16) HeapFree(GetProcessHeap(), 0, prefix16);
HeapFree(GetProcessHeap(), 0, prefix16);
return ret;
}

View File

@ -330,7 +330,7 @@ DWORD WINAPI FormatMessageA(
lstrcpynA(lpBuffer,target,nSize);
}
HeapFree(GetProcessHeap(),0,target);
if (from) HeapFree(GetProcessHeap(),0,from);
HeapFree(GetProcessHeap(),0,from);
TRACE("-- returning %d\n", (dwFlags & FORMAT_MESSAGE_ALLOCATE_BUFFER) ? strlen(*(LPSTR*)lpBuffer):strlen(lpBuffer));
return (dwFlags & FORMAT_MESSAGE_ALLOCATE_BUFFER) ?
strlen(*(LPSTR*)lpBuffer):
@ -543,7 +543,7 @@ DWORD WINAPI FormatMessageW(
else lstrcpynW(lpBuffer, target, nSize);
HeapFree(GetProcessHeap(),0,target);
if (from) HeapFree(GetProcessHeap(),0,from);
HeapFree(GetProcessHeap(),0,from);
TRACE("ret=%s\n", wine_dbgstr_w((dwFlags & FORMAT_MESSAGE_ALLOCATE_BUFFER) ?
*(LPWSTR*)lpBuffer : lpBuffer));
return (dwFlags & FORMAT_MESSAGE_ALLOCATE_BUFFER) ?

View File

@ -442,7 +442,7 @@ HGLOBAL16 WINAPI GlobalFree16(
TRACE("%04x\n", handle );
if (!GLOBAL_FreeBlock( handle )) return handle; /* failed */
if (ptr) HeapFree( GetProcessHeap(), 0, ptr );
HeapFree( GetProcessHeap(), 0, ptr );
return 0;
}

View File

@ -2066,10 +2066,8 @@ BOOL WINAPI NLS_EnumCalendarInfoAW(void *calinfoproc, LCID locale,
}
NLS_EnumCalendarInfoAW_Cleanup:
if (opt != NULL)
HeapFree(GetProcessHeap(), 0, opt);
if (buf != NULL)
HeapFree(GetProcessHeap(), 0, buf);
HeapFree(GetProcessHeap(), 0, opt);
HeapFree(GetProcessHeap(), 0, buf);
return ret;
}

View File

@ -1927,7 +1927,7 @@ HANDLE WINAPI Local32Init16( WORD segment, DWORD tableSize,
selectorOdd = SELECTOR_AllocBlock( base + 0x8000, totSize - 0x8000, WINE_LDT_FLAGS_DATA );
if ( !selectorTable || !selectorEven || !selectorOdd )
{
if ( selectorTable ) HeapFree( header->heap, 0, selectorTable );
HeapFree( header->heap, 0, selectorTable );
if ( selectorEven ) SELECTOR_FreeBlock( selectorEven );
if ( selectorOdd ) SELECTOR_FreeBlock( selectorOdd );
HeapDestroy( header->heap );

View File

@ -2267,12 +2267,10 @@ INT WINAPI FoldStringA(DWORD dwFlags, LPCSTR src, INT srclen,
}
}
if (dstW)
HeapFree(GetProcessHeap(), 0, dstW);
HeapFree(GetProcessHeap(), 0, dstW);
FoldStringA_exit:
if (srcW)
HeapFree(GetProcessHeap(), 0, srcW);
HeapFree(GetProcessHeap(), 0, srcW);
return ret;
}

View File

@ -726,7 +726,7 @@ static HMODULE16 NE_LoadExeHeader( HANDLE handle, LPCSTR path )
buffer ))
{
HeapFree( GetProcessHeap(), 0, buffer );
if (fastload) HeapFree( GetProcessHeap(), 0, fastload );
HeapFree( GetProcessHeap(), 0, fastload );
GlobalFree16( hModule );
return (HMODULE16)11; /* invalid exe */
}
@ -740,7 +740,7 @@ static HMODULE16 NE_LoadExeHeader( HANDLE handle, LPCSTR path )
}
else
{
if (fastload) HeapFree( GetProcessHeap(), 0, fastload );
HeapFree( GetProcessHeap(), 0, fastload );
GlobalFree16( hModule );
return (HMODULE16)11; /* invalid exe */
}
@ -766,7 +766,7 @@ static HMODULE16 NE_LoadExeHeader( HANDLE handle, LPCSTR path )
ne_header.ne_modtab - ne_header.ne_restab,
pData ))
{
if (fastload) HeapFree( GetProcessHeap(), 0, fastload );
HeapFree( GetProcessHeap(), 0, fastload );
GlobalFree16( hModule );
return (HMODULE16)11; /* invalid exe */
}
@ -781,7 +781,7 @@ static HMODULE16 NE_LoadExeHeader( HANDLE handle, LPCSTR path )
ne_header.ne_cmod * sizeof(WORD),
pData ))
{
if (fastload) HeapFree( GetProcessHeap(), 0, fastload );
HeapFree( GetProcessHeap(), 0, fastload );
GlobalFree16( hModule );
return (HMODULE16)11; /* invalid exe */
}
@ -796,7 +796,7 @@ static HMODULE16 NE_LoadExeHeader( HANDLE handle, LPCSTR path )
ne_header.ne_enttab - ne_header.ne_imptab,
pData ))
{
if (fastload) HeapFree( GetProcessHeap(), 0, fastload );
HeapFree( GetProcessHeap(), 0, fastload );
GlobalFree16( hModule );
return (HMODULE16)11; /* invalid exe */
}
@ -814,7 +814,7 @@ static HMODULE16 NE_LoadExeHeader( HANDLE handle, LPCSTR path )
ne_header.ne_cbenttab, pTempEntryTable ))
{
HeapFree( GetProcessHeap(), 0, pTempEntryTable );
if (fastload) HeapFree( GetProcessHeap(), 0, fastload );
HeapFree( GetProcessHeap(), 0, fastload );
GlobalFree16( hModule );
return (HMODULE16)11; /* invalid exe */
}
@ -878,7 +878,7 @@ static HMODULE16 NE_LoadExeHeader( HANDLE handle, LPCSTR path )
}
else
{
if (fastload) HeapFree( GetProcessHeap(), 0, fastload );
HeapFree( GetProcessHeap(), 0, fastload );
GlobalFree16( hModule );
return (HMODULE16)11; /* invalid exe */
}
@ -902,7 +902,7 @@ static HMODULE16 NE_LoadExeHeader( HANDLE handle, LPCSTR path )
/* Free the fast-load area */
#undef READ
if (fastload) HeapFree( GetProcessHeap(), 0, fastload );
HeapFree( GetProcessHeap(), 0, fastload );
/* Get the non-resident names table */

View File

@ -226,7 +226,7 @@ static BOOL add_boot_rename_entry( LPCWSTR source, LPCWSTR dest, DWORD flags )
RtlFreeUnicodeString( &source_name );
RtlFreeUnicodeString( &dest_name );
if (Reboot) NtClose(Reboot);
if (Buffer) HeapFree( GetProcessHeap(), 0, Buffer );
HeapFree( GetProcessHeap(), 0, Buffer );
return(rc);
}
@ -638,7 +638,7 @@ UINT WINAPI GetTempFileNameA( LPCSTR path, LPCSTR prefix, UINT unique, LPSTR buf
ret = GetTempFileNameW(pathW, prefixW, unique, bufferW);
if (ret) FILE_name_WtoA( bufferW, -1, buffer, MAX_PATH );
if (prefixW) HeapFree( GetProcessHeap(), 0, prefixW );
HeapFree( GetProcessHeap(), 0, prefixW );
return ret;
}
@ -830,7 +830,7 @@ DWORD WINAPI SearchPathA( LPCSTR path, LPCSTR name, LPCSTR ext,
ret = SearchPathW(pathW, nameW, extW, MAX_PATH, bufferW, NULL);
HeapFree( GetProcessHeap(), 0, pathW );
if (extW) HeapFree( GetProcessHeap(), 0, extW );
HeapFree( GetProcessHeap(), 0, extW );
if (!ret) return 0;
if (ret > MAX_PATH)
@ -1218,7 +1218,7 @@ BOOL WINAPI CreateDirectoryExA( LPCSTR template, LPCSTR path, LPSECURITY_ATTRIBU
if (template && !(templateW = FILE_name_AtoW( template, TRUE ))) return FALSE;
ret = CreateDirectoryExW( templateW, pathW, sa );
if (templateW) HeapFree( GetProcessHeap(), 0, templateW );
HeapFree( GetProcessHeap(), 0, templateW );
return ret;
}

View File

@ -835,7 +835,7 @@ static void init_current_directory( CURDIR *cur_dir )
RtlInitUnicodeString( &dir_str, DIR_Windows );
RtlSetCurrentDirectory_U( &dir_str );
}
if (cwd) HeapFree( GetProcessHeap(), 0, cwd );
HeapFree( GetProcessHeap(), 0, cwd );
done:
if (!cur_dir->Handle) chdir("/"); /* change to root directory so as not to lock cdroms */
@ -1849,9 +1849,9 @@ BOOL WINAPI CreateProcessA( LPCSTR app_name, LPSTR cmd_line, LPSECURITY_ATTRIBUT
ret = CreateProcessW( app_nameW, cmd_lineW, process_attr, thread_attr,
inherit, flags, env, cur_dirW, &infoW, info );
done:
if (app_nameW) HeapFree( GetProcessHeap(), 0, app_nameW );
if (cmd_lineW) HeapFree( GetProcessHeap(), 0, cmd_lineW );
if (cur_dirW) HeapFree( GetProcessHeap(), 0, cur_dirW );
HeapFree( GetProcessHeap(), 0, app_nameW );
HeapFree( GetProcessHeap(), 0, cmd_lineW );
HeapFree( GetProcessHeap(), 0, cur_dirW );
RtlFreeUnicodeString( &desktopW );
RtlFreeUnicodeString( &titleW );
return ret;
@ -1988,7 +1988,7 @@ BOOL WINAPI CreateProcessW( LPCWSTR app_name, LPWSTR cmd_line, LPSECURITY_ATTRIB
done:
if (tidy_cmdline != cmd_line) HeapFree( GetProcessHeap(), 0, tidy_cmdline );
if (envW != env) HeapFree( GetProcessHeap(), 0, envW );
if (unixdir) HeapFree( GetProcessHeap(), 0, unixdir );
HeapFree( GetProcessHeap(), 0, unixdir );
return retv;
}

View File

@ -550,7 +550,7 @@ static BOOL PROFILE_DeleteKey( PROFILESECTION **section,
{
PROFILEKEY *to_del = *key;
*key = to_del->next;
if (to_del->value) HeapFree( GetProcessHeap(), 0, to_del->value);
HeapFree( GetProcessHeap(), 0, to_del->value);
HeapFree( GetProcessHeap(), 0, to_del );
return TRUE;
}
@ -707,7 +707,7 @@ static void PROFILE_ReleaseFile(void)
{
PROFILE_FlushFile();
PROFILE_Free( CurProfile->section );
if (CurProfile->filename) HeapFree( GetProcessHeap(), 0, CurProfile->filename );
HeapFree( GetProcessHeap(), 0, CurProfile->filename );
CurProfile->changed = FALSE;
CurProfile->section = NULL;
CurProfile->filename = NULL;
@ -1170,7 +1170,7 @@ INT16 WINAPI GetPrivateProfileString16( LPCSTR section, LPCSTR entry,
RtlFreeUnicodeString(&entryW);
RtlFreeUnicodeString(&def_valW);
RtlFreeUnicodeString(&filenameW);
if (bufferW) HeapFree(GetProcessHeap(), 0, bufferW);
HeapFree(GetProcessHeap(), 0, bufferW);
return ret;
}
@ -1214,7 +1214,7 @@ INT WINAPI GetPrivateProfileStringA( LPCSTR section, LPCSTR entry,
RtlFreeUnicodeString(&entryW);
RtlFreeUnicodeString(&def_valW);
RtlFreeUnicodeString(&filenameW);
if (bufferW) HeapFree(GetProcessHeap(), 0, bufferW);
HeapFree(GetProcessHeap(), 0, bufferW);
return ret;
}
@ -1381,7 +1381,7 @@ INT WINAPI GetPrivateProfileSectionA( LPCSTR section, LPSTR buffer,
RtlFreeUnicodeString(&sectionW);
RtlFreeUnicodeString(&filenameW);
if (bufferW) HeapFree(GetProcessHeap(), 0, bufferW);
HeapFree(GetProcessHeap(), 0, bufferW);
return ret;
}
@ -1632,7 +1632,7 @@ DWORD WINAPI GetPrivateProfileSectionNamesA( LPSTR buffer, DWORD size,
}
RtlFreeUnicodeString(&filenameW);
if (bufferW) HeapFree(GetProcessHeap(), 0, bufferW);
HeapFree(GetProcessHeap(), 0, bufferW);
return ret;
}

View File

@ -288,7 +288,7 @@ BOOL WINAPI EnumResourceTypesA( HMODULE hmod, ENUMRESTYPEPROCA lpfun, LONG_PTR l
if (newlen + 1 > len)
{
len = newlen + 1;
if (type) HeapFree( GetProcessHeap(), 0, type );
HeapFree( GetProcessHeap(), 0, type );
if (!(type = HeapAlloc( GetProcessHeap(), 0, len ))) return FALSE;
}
WideCharToMultiByte( CP_ACP, 0, str->NameString, str->Length, type, len, NULL, NULL);
@ -301,7 +301,7 @@ BOOL WINAPI EnumResourceTypesA( HMODULE hmod, ENUMRESTYPEPROCA lpfun, LONG_PTR l
}
if (!ret) break;
}
if (type) HeapFree( GetProcessHeap(), 0, type );
HeapFree( GetProcessHeap(), 0, type );
return ret;
}
@ -337,7 +337,7 @@ BOOL WINAPI EnumResourceTypesW( HMODULE hmod, ENUMRESTYPEPROCW lpfun, LONG_PTR l
if (str->Length + 1 > len)
{
len = str->Length + 1;
if (type) HeapFree( GetProcessHeap(), 0, type );
HeapFree( GetProcessHeap(), 0, type );
if (!(type = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) ))) return FALSE;
}
memcpy(type, str->NameString, str->Length * sizeof (WCHAR));
@ -350,7 +350,7 @@ BOOL WINAPI EnumResourceTypesW( HMODULE hmod, ENUMRESTYPEPROCW lpfun, LONG_PTR l
}
if (!ret) break;
}
if (type) HeapFree( GetProcessHeap(), 0, type );
HeapFree( GetProcessHeap(), 0, type );
return ret;
}
@ -393,7 +393,7 @@ BOOL WINAPI EnumResourceNamesA( HMODULE hmod, LPCSTR type, ENUMRESNAMEPROCA lpfu
if (newlen + 1 > len)
{
len = newlen + 1;
if (name) HeapFree( GetProcessHeap(), 0, name );
HeapFree( GetProcessHeap(), 0, name );
if (!(name = HeapAlloc(GetProcessHeap(), 0, len + 1 )))
{
ret = FALSE;
@ -411,7 +411,7 @@ BOOL WINAPI EnumResourceNamesA( HMODULE hmod, LPCSTR type, ENUMRESNAMEPROCA lpfu
if (!ret) break;
}
done:
if (name) HeapFree( GetProcessHeap(), 0, name );
HeapFree( GetProcessHeap(), 0, name );
if (HIWORD(typeW.Buffer)) HeapFree( GetProcessHeap(), 0, typeW.Buffer );
if (status != STATUS_SUCCESS) SetLastError( RtlNtStatusToDosError(status) );
return ret;
@ -454,7 +454,7 @@ BOOL WINAPI EnumResourceNamesW( HMODULE hmod, LPCWSTR type, ENUMRESNAMEPROCW lpf
if (str->Length + 1 > len)
{
len = str->Length + 1;
if (name) HeapFree( GetProcessHeap(), 0, name );
HeapFree( GetProcessHeap(), 0, name );
if (!(name = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) )))
{
ret = FALSE;
@ -472,7 +472,7 @@ BOOL WINAPI EnumResourceNamesW( HMODULE hmod, LPCWSTR type, ENUMRESNAMEPROCW lpf
if (!ret) break;
}
done:
if (name) HeapFree( GetProcessHeap(), 0, name );
HeapFree( GetProcessHeap(), 0, name );
if (HIWORD(typeW.Buffer)) HeapFree( GetProcessHeap(), 0, typeW.Buffer );
if (status != STATUS_SUCCESS) SetLastError( RtlNtStatusToDosError(status) );
return ret;
@ -747,7 +747,7 @@ HANDLE WINAPI BeginUpdateResourceW( LPCWSTR pFileName, BOOL bDeleteExistingResou
done:
if(!ret && current_updates)
{
if(current_updates->pFileName) HeapFree(GetProcessHeap(), 0, current_updates->pFileName);
HeapFree(GetProcessHeap(), 0, current_updates->pFileName);
GlobalUnlock(hUpdate);
GlobalFree(hUpdate);
hUpdate = NULL;
@ -890,7 +890,7 @@ done:
{
if(HIWORD(current_resource->lpType)) HeapFree(GetProcessHeap(), 0, current_resource->lpType);
if(HIWORD(current_resource->lpName)) HeapFree(GetProcessHeap(), 0, current_resource->lpName);
if(current_resource->lpData) HeapFree(GetProcessHeap(), 0, current_resource->lpData);
HeapFree(GetProcessHeap(), 0, current_resource->lpData);
HeapFree(GetProcessHeap(), 0, current_resource);
}
if(found) GlobalUnlock(hUpdate);

View File

@ -1532,8 +1532,7 @@ HANDLE WINAPI CreateMailslotA( LPCSTR lpName, DWORD nMaxMessageSize,
handle = CreateMailslotW( name, nMaxMessageSize, lReadTimeout, sa );
if( name )
HeapFree( GetProcessHeap(), 0, name );
HeapFree( GetProcessHeap(), 0, name );
return handle;
}
@ -1671,8 +1670,7 @@ HANDLE WINAPI CreateJobObjectA( LPSECURITY_ATTRIBUTES attr, LPCSTR name )
r = CreateJobObjectW( attr, str );
if( str )
HeapFree( GetProcessHeap(), 0, str );
HeapFree( GetProcessHeap(), 0, str );
return r;
}

View File

@ -77,9 +77,7 @@ static void test_Heap(void)
*/
mem1=HeapAlloc(heap,0,5*memchunk+1);
ok(mem1==NULL,"HeapCreate allocated more Ram than it should have\n");
if(mem1) {
HeapFree(heap,0,mem1);
}
HeapFree(heap,0,mem1);
}
/* Check that a normal alloc works */

View File

@ -575,8 +575,7 @@ int WINAPI GetCalendarInfoA(LCID lcid, CALID Calendar, CALTYPE CalType,
ret = GetCalendarInfoW(lcid, Calendar, CalType, lpCalDataW, cchData, lpValue);
if(ret && lpCalDataW && lpCalData)
WideCharToMultiByte(CP_ACP, 0, lpCalDataW, cchData, lpCalData, cchData, NULL, NULL);
if(lpCalDataW)
HeapFree(GetProcessHeap(), 0, lpCalDataW);
HeapFree(GetProcessHeap(), 0, lpCalDataW);
return ret;
}

View File

@ -896,8 +896,8 @@ BOOL WINAPI GetVolumeInformationA( LPCSTR root, LPSTR label,
if (fsname) FILE_name_WtoA( fsnameW, -1, fsname, fsname_len );
}
if (labelW) HeapFree( GetProcessHeap(), 0, labelW );
if (fsnameW) HeapFree( GetProcessHeap(), 0, fsnameW );
HeapFree( GetProcessHeap(), 0, labelW );
HeapFree( GetProcessHeap(), 0, fsnameW );
return ret;
}
@ -1011,7 +1011,7 @@ BOOL WINAPI SetVolumeLabelA(LPCSTR root, LPCSTR volname)
if (root && !(rootW = FILE_name_AtoW( root, FALSE ))) return FALSE;
if (volname && !(volnameW = FILE_name_AtoW( volname, TRUE ))) return FALSE;
ret = SetVolumeLabelW( rootW, volnameW );
if (volnameW) HeapFree( GetProcessHeap(), 0, volnameW );
HeapFree( GetProcessHeap(), 0, volnameW );
return ret;
}
@ -1092,7 +1092,7 @@ BOOL WINAPI DefineDosDeviceW( DWORD flags, LPCWSTR devname, LPCWSTR targetpath )
}
HeapFree( GetProcessHeap(), 0, path );
}
if (target) HeapFree( GetProcessHeap(), 0, target );
HeapFree( GetProcessHeap(), 0, target );
return ret;
}
@ -1108,7 +1108,7 @@ BOOL WINAPI DefineDosDeviceA(DWORD flags, LPCSTR devname, LPCSTR targetpath)
if (!(devW = FILE_name_AtoW( devname, FALSE ))) return FALSE;
if (targetpath && !(targetW = FILE_name_AtoW( targetpath, TRUE ))) return FALSE;
ret = DefineDosDeviceW(flags, devW, targetW);
if (targetW) HeapFree( GetProcessHeap(), 0, targetW );
HeapFree( GetProcessHeap(), 0, targetW );
return ret;
}

View File

@ -578,7 +578,7 @@ void WINAPI LZClose( HFILE fd )
if (!(lzs = GET_LZ_STATE(fd))) _lclose(fd);
else
{
if (lzs->get) HeapFree( GetProcessHeap(), 0, lzs->get );
HeapFree( GetProcessHeap(), 0, lzs->get );
CloseHandle((HANDLE)lzs->realfd);
lzstates[fd - 0x400] = NULL;
HeapFree( GetProcessHeap(), 0, lzs );

View File

@ -197,8 +197,7 @@ static void _tryLoadProvider(PCWSTR provider)
{
WARN("Provider %s didn't export NPGetCaps\n",
debugstr_w(provider));
if (name)
HeapFree(GetProcessHeap(), 0, name);
HeapFree(GetProcessHeap(), 0, name);
FreeLibrary(hLib);
}
}
@ -311,8 +310,7 @@ void wnetFree(void)
HeapFree(GetProcessHeap(), 0, providerTable->table[i].name);
FreeModule(providerTable->table[i].hLib);
}
if (providerTable->entireNetwork)
HeapFree(GetProcessHeap(), 0, providerTable->entireNetwork);
HeapFree(GetProcessHeap(), 0, providerTable->entireNetwork);
HeapFree(GetProcessHeap(), 0, providerTable);
providerTable = NULL;
}
@ -371,8 +369,7 @@ static void _freeEnumNetResource(LPNETRESOURCEW lpNet)
{
if (lpNet)
{
if (lpNet->lpRemoteName)
HeapFree(GetProcessHeap(), 0, lpNet->lpRemoteName);
HeapFree(GetProcessHeap(), 0, lpNet->lpRemoteName);
HeapFree(GetProcessHeap(), 0, lpNet);
}
}

View File

@ -341,10 +341,8 @@ PWINE_ACMDRIVERID MSACM_UnregisterDriver(PWINE_ACMDRIVERID p)
while (p->pACMDriverList)
acmDriverClose((HACMDRIVER) p->pACMDriverList, 0);
if (p->pszDriverAlias)
HeapFree(MSACM_hHeap, 0, p->pszDriverAlias);
if (p->pszFileName)
HeapFree(MSACM_hHeap, 0, p->pszFileName);
HeapFree(MSACM_hHeap, 0, p->pszDriverAlias);
HeapFree(MSACM_hHeap, 0, p->pszFileName);
HeapFree(MSACM_hHeap, 0, p->aFormatTag);
if (p == MSACM_pFirstACMDriverID)

View File

@ -296,11 +296,8 @@ static BOOL IEnumDMO_Destructor(IEnumDMO* iface)
if (This->hkey)
RegCloseKey(This->hkey);
if (This->pInTypes)
HeapFree(GetProcessHeap(), 0, This->pInTypes);
if (This->pOutTypes)
HeapFree(GetProcessHeap(), 0, This->pOutTypes);
HeapFree(GetProcessHeap(), 0, This->pInTypes);
HeapFree(GetProcessHeap(), 0, This->pOutTypes);
return TRUE;
}

View File

@ -310,12 +310,12 @@ void msvcrt_init_args(void)
void msvcrt_free_args(void)
{
/* FIXME: more things to free */
if (MSVCRT___initenv) HeapFree(GetProcessHeap(), 0, MSVCRT___initenv);
if (MSVCRT___winitenv) HeapFree(GetProcessHeap(), 0, MSVCRT___winitenv);
if (_environ) HeapFree(GetProcessHeap(), 0, _environ);
if (_wenviron) HeapFree(GetProcessHeap(), 0, _wenviron);
if (MSVCRT__pgmptr) HeapFree(GetProcessHeap(), 0, MSVCRT__pgmptr);
if (MSVCRT__wpgmptr) HeapFree(GetProcessHeap(), 0, MSVCRT__wpgmptr);
HeapFree(GetProcessHeap(), 0, MSVCRT___initenv);
HeapFree(GetProcessHeap(), 0, MSVCRT___winitenv);
HeapFree(GetProcessHeap(), 0, _environ);
HeapFree(GetProcessHeap(), 0, _wenviron);
HeapFree(GetProcessHeap(), 0, MSVCRT__pgmptr);
HeapFree(GetProcessHeap(), 0, MSVCRT__wpgmptr);
}
/*********************************************************************

View File

@ -68,7 +68,7 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
case DLL_THREAD_DETACH:
/* Free TLS */
tls = TlsGetValue(msvcrt_tls_index);
if (tls) HeapFree(GetProcessHeap(), 0, tls);
HeapFree(GetProcessHeap(), 0, tls);
TRACE("finished thread free\n");
break;
}

View File

@ -131,16 +131,10 @@ BOOL VFWAPI DrawDibEnd(HDRAWDIB hdd)
whdd->hpal = 0; /* Do not free this */
whdd->hdc = 0;
if (whdd->lpbi)
{
HeapFree(GetProcessHeap(), 0, whdd->lpbi);
whdd->lpbi = NULL;
}
if (whdd->lpbiOut)
{
HeapFree(GetProcessHeap(), 0, whdd->lpbiOut);
whdd->lpbiOut = NULL;
}
HeapFree(GetProcessHeap(), 0, whdd->lpbi);
whdd->lpbi = NULL;
HeapFree(GetProcessHeap(), 0, whdd->lpbiOut);
whdd->lpbiOut = NULL;
whdd->begun = FALSE;
@ -282,11 +276,8 @@ BOOL VFWAPI DrawDibBegin(HDRAWDIB hdd,
{
if (whdd->hic)
ICClose(whdd->hic);
if (whdd->lpbiOut)
{
HeapFree(GetProcessHeap(), 0, whdd->lpbiOut);
whdd->lpbiOut = NULL;
}
HeapFree(GetProcessHeap(), 0, whdd->lpbiOut);
whdd->lpbiOut = NULL;
}
return ret;

View File

@ -1328,11 +1328,8 @@ end_of_mci_open:
mwi->mode = MCI_MODE_NOT_READY;
mwi->position = -1;
if (mwi->lpName)
{
HeapFree(GetProcessHeap(), 0, mwi->lpName);
mwi->lpName = NULL;
}
HeapFree(GetProcessHeap(), 0, mwi->lpName);
mwi->lpName = NULL;
MCIWND_UpdateState(mwi);
GetClientRect(hWnd, &rc);

View File

@ -259,7 +259,7 @@ BOOL VFWAPI ICInstall(DWORD fccType, DWORD fccHandler, LPARAM lParam, LPSTR szDe
return TRUE;
oom:
if (driver) HeapFree(GetProcessHeap(), 0, driver);
HeapFree(GetProcessHeap(), 0, driver);
return FALSE;
}
@ -284,8 +284,7 @@ BOOL VFWAPI ICRemove(DWORD fccType, DWORD fccHandler, UINT wFlags)
/* Remove the driver from the list */
*pdriver = (*pdriver)->next;
if ((*pdriver)->name)
HeapFree(GetProcessHeap(), 0, (*pdriver)->name);
HeapFree(GetProcessHeap(), 0, (*pdriver)->name);
HeapFree(GetProcessHeap(), 0, *pdriver);
return TRUE;
@ -1104,8 +1103,7 @@ err:
ICDecompressEnd( hic );
if ( bReleaseIC )
ICClose(hic);
if ( pHdr != NULL )
HeapFree(GetProcessHeap(),0,pHdr);
HeapFree(GetProcessHeap(),0,pHdr);
if ( pMem != NULL )
GlobalUnlock( hMem );
if ( !bSucceeded && hMem != NULL )

View File

@ -53,8 +53,7 @@ static void NBNameCacheUnlinkNode(struct NBNameCache *cache,
{
NBNameCacheNode *next = (*prev)->next;
if ((*prev)->entry)
HeapFree(cache->heap, 0, (*prev)->entry);
HeapFree(cache->heap, 0, (*prev)->entry);
HeapFree(cache->heap, 0, *prev);
*prev = next;
}

View File

@ -275,8 +275,7 @@ HRESULT WINAPI BindCtxImpl_RevokeObjectBound(IBindCtx* iface, IUnknown* punk)
if(This->bindCtxTable[index].pObj)
IUnknown_Release(This->bindCtxTable[index].pObj);
if(This->bindCtxTable[index].pkeyObj)
HeapFree(GetProcessHeap(),0,This->bindCtxTable[index].pkeyObj);
HeapFree(GetProcessHeap(),0,This->bindCtxTable[index].pkeyObj);
/* left-shift all elements in the right side of the current revoked object */
for(j=index; j<This->bindCtxTableLastIndex-1; j++)
@ -472,8 +471,7 @@ HRESULT WINAPI BindCtxImpl_RevokeObjectParam(IBindCtx* iface,LPOLESTR ppenum)
/* release the object if it's found */
if(This->bindCtxTable[index].pObj)
IUnknown_Release(This->bindCtxTable[index].pObj);
if(This->bindCtxTable[index].pkeyObj)
HeapFree(GetProcessHeap(),0,This->bindCtxTable[index].pkeyObj);
HeapFree(GetProcessHeap(),0,This->bindCtxTable[index].pkeyObj);
/* remove the object from the table with a left-shifting of all objects in the right side */
for(j=index; j<This->bindCtxTableLastIndex-1; j++)

View File

@ -1489,8 +1489,7 @@ CLEANUP:
/*
* Free the array of FORMATETC's
*/
if (afmt)
HeapFree(GetProcessHeap(), 0, afmt);
HeapFree(GetProcessHeap(), 0, afmt);
/*
* Close Windows clipboard

View File

@ -1132,8 +1132,7 @@ static HRESULT WINAPI DataCache_GetData(
cleanup:
if (mfBits)
HeapFree(GetProcessHeap(), 0, mfBits);
HeapFree(GetProcessHeap(), 0, mfBits);
if (pStream)
IStream_Release(pStream);

View File

@ -514,17 +514,10 @@ static void DefaultHandler_Destroy(
/*
* Free the strings idenfitying the object
*/
if (ptrToDestroy->containerApp!=NULL)
{
HeapFree( GetProcessHeap(), 0, ptrToDestroy->containerApp );
ptrToDestroy->containerApp = NULL;
}
if (ptrToDestroy->containerObj!=NULL)
{
HeapFree( GetProcessHeap(), 0, ptrToDestroy->containerObj );
ptrToDestroy->containerObj = NULL;
}
HeapFree( GetProcessHeap(), 0, ptrToDestroy->containerApp );
ptrToDestroy->containerApp = NULL;
HeapFree( GetProcessHeap(), 0, ptrToDestroy->containerObj );
ptrToDestroy->containerObj = NULL;
/*
* Release our reference to the data cache.
@ -822,17 +815,10 @@ static HRESULT WINAPI DefaultHandler_SetHostNames(
/*
* Be sure to cleanup before re-assinging the strings.
*/
if (this->containerApp!=NULL)
{
HeapFree( GetProcessHeap(), 0, this->containerApp );
this->containerApp = NULL;
}
if (this->containerObj!=NULL)
{
HeapFree( GetProcessHeap(), 0, this->containerObj );
this->containerObj = NULL;
}
HeapFree( GetProcessHeap(), 0, this->containerApp );
this->containerApp = NULL;
HeapFree( GetProcessHeap(), 0, this->containerObj );
this->containerObj = NULL;
/*
* Copy the string supplied.

View File

@ -325,8 +325,7 @@ HRESULT WINAPI FileMonikerImpl_Load(IMoniker* iface,IStream* pStm)
return E_FAIL;
}
if (This->filePathName!=NULL)
HeapFree(GetProcessHeap(),0,This->filePathName);
HeapFree(GetProcessHeap(),0,This->filePathName);
This->filePathName=filePathW;
@ -540,9 +539,7 @@ HRESULT WINAPI FileMonikerImpl_Destroy(FileMonikerImpl* This)
{
TRACE("(%p)\n",This);
if (This->filePathName!=NULL)
HeapFree(GetProcessHeap(),0,This->filePathName);
HeapFree(GetProcessHeap(),0,This->filePathName);
HeapFree(GetProcessHeap(),0,This);
return S_OK;

View File

@ -415,12 +415,8 @@ HRESULT WINAPI ItemMonikerImpl_Destroy(ItemMonikerImpl* This)
{
TRACE("(%p)\n",This);
if (This->itemName)
HeapFree(GetProcessHeap(),0,This->itemName);
if (This->itemDelimiter)
HeapFree(GetProcessHeap(),0,This->itemDelimiter);
HeapFree(GetProcessHeap(),0,This->itemName);
HeapFree(GetProcessHeap(),0,This->itemDelimiter);
HeapFree(GetProcessHeap(),0,This);
return S_OK;

View File

@ -985,8 +985,7 @@ BOOL OLEMenu_UnInstallHooks( DWORD tid )
CLEANUP:
/* Release the hook table entry */
if (pHookItem)
HeapFree(pHookItem->hHeap, 0, pHookItem );
HeapFree(pHookItem->hHeap, 0, pHookItem );
return FALSE;
}

View File

@ -2395,8 +2395,7 @@ void StorageImpl_Destroy(
{
TRACE("(%p)\n", This);
if(This->pwcsName)
HeapFree(GetProcessHeap(), 0, This->pwcsName);
HeapFree(GetProcessHeap(), 0, This->pwcsName);
BlockChainStream_Destroy(This->smallBlockRootChain);
BlockChainStream_Destroy(This->rootBlockChain);
@ -7355,15 +7354,9 @@ HRESULT WINAPI OleConvertOLESTREAMToIStorage (
/* Free allocated memory */
for(i=0; i < 2; i++)
{
if(pOleStreamData[i].pData != NULL)
{
HeapFree(GetProcessHeap(),0,pOleStreamData[i].pData);
}
if(pOleStreamData[i].pstrOleObjFileName != NULL)
{
HeapFree(GetProcessHeap(),0,pOleStreamData[i].pstrOleObjFileName);
pOleStreamData[i].pstrOleObjFileName = NULL;
}
HeapFree(GetProcessHeap(),0,pOleStreamData[i].pData);
HeapFree(GetProcessHeap(),0,pOleStreamData[i].pstrOleObjFileName);
pOleStreamData[i].pstrOleObjFileName = NULL;
}
return hRes;
}
@ -7432,10 +7425,7 @@ HRESULT WINAPI OleConvertIStorageToOLESTREAM (
/* Free allocated memory */
for(i=0; i < 2; i++)
{
if(pOleStreamData[i].pData != NULL)
{
HeapFree(GetProcessHeap(),0,pOleStreamData[i].pData);
}
HeapFree(GetProcessHeap(),0,pOleStreamData[i].pData);
}
return hRes;

View File

@ -454,8 +454,7 @@ static void OLEFontImpl_Destroy(OLEFontImpl* fontDesc)
{
TRACE("(%p)\n", fontDesc);
if (fontDesc->description.lpstrName!=0)
HeapFree(GetProcessHeap(), 0, fontDesc->description.lpstrName);
HeapFree(GetProcessHeap(), 0, fontDesc->description.lpstrName);
if (fontDesc->gdiFont!=0)
DeleteObject(fontDesc->gdiFont);
@ -1594,8 +1593,7 @@ static HRESULT WINAPI OLEFontImpl_Load(
if (cbRead!=bStringSize)
return E_FAIL;
if (this->description.lpstrName!=0)
HeapFree(GetProcessHeap(), 0, this->description.lpstrName);
HeapFree(GetProcessHeap(), 0, this->description.lpstrName);
len = MultiByteToWideChar( CP_ACP, 0, readBuffer, bStringSize, NULL, 0 );
this->description.lpstrName = HeapAlloc( GetProcessHeap(), 0, (len+1) * sizeof(WCHAR) );

View File

@ -301,7 +301,7 @@ static void OLEPictureImpl_Destroy(OLEPictureImpl* Obj)
break;
}
}
if (Obj->data) HeapFree(GetProcessHeap(), 0, Obj->data);
HeapFree(GetProcessHeap(), 0, Obj->data);
HeapFree(GetProcessHeap(), 0, Obj);
}

View File

@ -3032,10 +3032,8 @@ static ULONG WINAPI ICreateTypeLib2_fnRelease(ICreateTypeLib2 *iface)
}
}
if (This->filename) {
HeapFree(GetProcessHeap(), 0, This->filename);
This->filename = NULL;
}
HeapFree(GetProcessHeap(), 0, This->filename);
This->filename = NULL;
while (This->typeinfos) {
ICreateTypeInfo2Impl *typeinfo = This->typeinfos;

View File

@ -544,8 +544,8 @@ static BOOL internal_wglUseFontBitmaps(HDC hdc,
if (needed_size > size) {
size = needed_size;
if (bitmap) HeapFree(GetProcessHeap(), 0, bitmap);
if (gl_bitmap) HeapFree(GetProcessHeap(), 0, gl_bitmap);
HeapFree(GetProcessHeap(), 0, bitmap);
HeapFree(GetProcessHeap(), 0, gl_bitmap);
bitmap = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, size);
gl_bitmap = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, size);
}
@ -610,8 +610,8 @@ static BOOL internal_wglUseFontBitmaps(HDC hdc,
glPixelStorei(GL_UNPACK_ALIGNMENT, org_alignment);
LEAVE_GL();
if (bitmap) HeapFree(GetProcessHeap(), 0, bitmap);
if (gl_bitmap) HeapFree(GetProcessHeap(), 0, gl_bitmap);
HeapFree(GetProcessHeap(), 0, bitmap);
HeapFree(GetProcessHeap(), 0, gl_bitmap);
return TRUE;
error:
@ -619,8 +619,8 @@ static BOOL internal_wglUseFontBitmaps(HDC hdc,
glPixelStorei(GL_UNPACK_ALIGNMENT, org_alignment);
LEAVE_GL();
if (bitmap) HeapFree(GetProcessHeap(), 0, bitmap);
if (gl_bitmap) HeapFree(GetProcessHeap(), 0, gl_bitmap);
HeapFree(GetProcessHeap(), 0, bitmap);
HeapFree(GetProcessHeap(), 0, gl_bitmap);
return FALSE;
}

View File

@ -156,8 +156,7 @@ static ULONG WINAPI BaseMemAllocator_Release(IMemAllocator * iface)
CloseHandle(This->hSemWaiting);
if (This->bCommitted)
This->fnFree(iface);
if (This->pProps)
HeapFree(GetProcessHeap(), 0, This->pProps);
HeapFree(GetProcessHeap(), 0, This->pProps);
CoTaskMemFree(This);
return 0;
}

View File

@ -2546,8 +2546,7 @@ char *p;
void RTFFree(char *p)
{
if (p != (char *) NULL)
HeapFree(RICHED32_hHeap, 0, p);
HeapFree(RICHED32_hHeap, 0, p);
}

View File

@ -96,7 +96,7 @@ LPWSTR RPCRT4_strndupW(LPWSTR src, INT slen)
void RPCRT4_strfree(LPSTR src)
{
if (src) HeapFree(GetProcessHeap(), 0, src);
HeapFree(GetProcessHeap(), 0, src);
}
RPC_STATUS RPCRT4_CreateConnection(RpcConnection** Connection, BOOL server, LPSTR Protseq, LPSTR NetworkAddr, LPSTR Endpoint, LPSTR NetworkOptions, RpcBinding* Binding)

View File

@ -447,8 +447,7 @@ RPC_STATUS WINAPI I_RpcGetBuffer(PRPC_MESSAGE pMsg)
* it, we'll leave deallocating the original buffer to the RPC server */
pMsg->Buffer = HeapAlloc(GetProcessHeap(), 0, pMsg->BufferLength);
} else {
if (pMsg->Buffer)
HeapFree(GetProcessHeap(), 0, pMsg->Buffer);
HeapFree(GetProcessHeap(), 0, pMsg->Buffer);
pMsg->Buffer = HeapAlloc(GetProcessHeap(), 0, pMsg->BufferLength);
}
TRACE("Buffer=%p\n", pMsg->Buffer);
@ -463,9 +462,7 @@ RPC_STATUS WINAPI I_RpcFreeBuffer(PRPC_MESSAGE pMsg)
{
TRACE("(%p) Buffer=%p\n", pMsg, pMsg->Buffer);
/* FIXME: pfnFree? */
if (pMsg->Buffer != NULL) {
HeapFree(GetProcessHeap(), 0, pMsg->Buffer);
}
HeapFree(GetProcessHeap(), 0, pMsg->Buffer);
pMsg->Buffer = NULL;
return S_OK;
}

View File

@ -422,7 +422,7 @@ static DWORD CALLBACK RPCRT4_io_thread(LPVOID the_arg)
#endif
msg = NULL;
}
if (msg) HeapFree(GetProcessHeap(), 0, msg);
HeapFree(GetProcessHeap(), 0, msg);
RPCRT4_DestroyConnection(conn);
return 0;
}

View File

@ -75,8 +75,7 @@ void destroy_handle_table(HANDLETABLE *lpTable)
{
TRACE("(lpTable=%p)\n", lpTable);
if (lpTable->paEntries)
HeapFree(GetProcessHeap(), 0, lpTable->paEntries);
HeapFree(GetProcessHeap(), 0, lpTable->paEntries);
DeleteCriticalSection(&lpTable->mutex);
}

View File

@ -336,8 +336,8 @@ static inline const PROV_ENUMALGS_EX* get_algid_info(KEYCONTAINER *pKeyContainer
*/
static inline void free_hmac_info(PHMAC_INFO hmac_info) {
if (!hmac_info) return;
if (hmac_info->pbInnerString) HeapFree(GetProcessHeap(), 0, hmac_info->pbInnerString);
if (hmac_info->pbOuterString) HeapFree(GetProcessHeap(), 0, hmac_info->pbOuterString);
HeapFree(GetProcessHeap(), 0, hmac_info->pbInnerString);
HeapFree(GetProcessHeap(), 0, hmac_info->pbOuterString);
HeapFree(GetProcessHeap(), 0, hmac_info);
}
@ -2836,8 +2836,8 @@ BOOL WINAPI RSAENH_CPVerifySignature(HCRYPTPROV hProv, HCRYPTHASH hHash, CONST B
res = TRUE;
cleanup:
if (pbConstructed) HeapFree(GetProcessHeap(), 0, pbConstructed);
if (pbDecrypted) HeapFree(GetProcessHeap(), 0, pbDecrypted);
HeapFree(GetProcessHeap(), 0, pbConstructed);
HeapFree(GetProcessHeap(), 0, pbDecrypted);
return res;
}

View File

@ -423,8 +423,7 @@ static LPWSTR SERIALUI_strdup( LPCSTR str )
static VOID SERIALUI_strfree( LPWSTR strW )
{
if (strW)
HeapFree( GetProcessHeap(), 0, strW );
HeapFree( GetProcessHeap(), 0, strW );
}
/***********************************************************************

View File

@ -169,8 +169,7 @@ static void *grow_array( void *array, unsigned int *count, size_t elem )
if (new_array)
*count = new_count;
else
if (array)
HeapFree( GetProcessHeap(), 0, array );
HeapFree( GetProcessHeap(), 0, array );
return new_array;
}

View File

@ -476,9 +476,9 @@ RETERR16 WINAPI CtlSetLdd16(LPLOGDISKDESC pldd)
else
{
pCurrLDD = pCurr->pldd;
if (pCurrLDD->pszPath) HeapFree(heap, 0, pCurrLDD->pszPath);
if (pCurrLDD->pszVolLabel) HeapFree(heap, 0, pCurrLDD->pszVolLabel);
if (pCurrLDD->pszDiskName) HeapFree(heap, 0, pCurrLDD->pszDiskName);
HeapFree(heap, 0, pCurrLDD->pszPath);
HeapFree(heap, 0, pCurrLDD->pszVolLabel);
HeapFree(heap, 0, pCurrLDD->pszDiskName);
}
memcpy(pCurrLDD, pldd, sizeof(LOGDISKDESC_S));

View File

@ -187,10 +187,8 @@ static ULONG WINAPI IAutoComplete_fnRelease(
if (!--(This->ref)) {
TRACE(" destroying IAutoComplete(%p)\n",This);
if (This->quickComplete)
HeapFree(GetProcessHeap(), 0, This->quickComplete);
if (This->txtbackup)
HeapFree(GetProcessHeap(), 0, This->txtbackup);
HeapFree(GetProcessHeap(), 0, This->quickComplete);
HeapFree(GetProcessHeap(), 0, This->txtbackup);
if (This->hwndListBox)
DestroyWindow(This->hwndListBox);
if (This->enumstr)

View File

@ -491,10 +491,7 @@ LPITEMIDLIST WINAPI SHBrowseForFolderA (LPBROWSEINFOA lpbi)
WideCharToMultiByte(CP_ACP, 0, bi.pszDisplayName, -1, lpbi->pszDisplayName, MAX_PATH, 0, NULL);
HeapFree(GetProcessHeap(), 0, bi.pszDisplayName);
}
if (bi.lpszTitle)
{
HeapFree(GetProcessHeap(), 0, (LPVOID)bi.lpszTitle);
}
HeapFree(GetProcessHeap(), 0, (LPVOID)bi.lpszTitle);
lpbi->iImage = bi.iImage;
return lpid;
}

View File

@ -1057,7 +1057,7 @@ LPITEMIDLIST WINAPI SHSimpleIDListFromPathA(LPCSTR lpszPath)
_ILParsePathW(wPath, NULL, TRUE, &pidl, NULL);
if (wPath) HeapFree(GetProcessHeap(), 0, wPath);
HeapFree(GetProcessHeap(), 0, wPath);
TRACE("%s %p\n", debugstr_a(lpszPath), pidl);
return pidl;
}

View File

@ -812,8 +812,8 @@ BOOL WINAPI ShellAboutA( HWND hWnd, LPCSTR szApp, LPCSTR szOtherStuff, HICON hIc
ret = ShellAboutW(hWnd, appW, otherW, hIcon);
if (otherW) HeapFree(GetProcessHeap(), 0, otherW);
if (appW) HeapFree(GetProcessHeap(), 0, appW);
HeapFree(GetProcessHeap(), 0, otherW);
HeapFree(GetProcessHeap(), 0, appW);
return ret;
}

Some files were not shown because too many files have changed in this diff Show More