From 5ad7d858e0d6168429fca902500ac5b50f14dc30 Mon Sep 17 00:00:00 2001 From: Michael Stefaniuc Date: Thu, 23 Dec 2004 17:06:43 +0000 Subject: [PATCH] Do not check for non NULL pointer before HeapFree'ing it. It's redundant. --- dlls/advapi32/registry.c | 2 +- dlls/advapi32/security.c | 12 +++---- dlls/advapi32/service.c | 2 +- dlls/comctl32/animate.c | 28 +++++---------- dlls/comctl32/syslink.c | 10 ++---- dlls/comctl32/toolbar.c | 10 ++---- dlls/commdlg/filedlg.c | 5 +-- dlls/commdlg/filedlg31.c | 12 +++---- dlls/commdlg/fontdlg.c | 3 +- dlls/commdlg/fontdlg16.c | 6 ++-- dlls/commdlg/printdlg.c | 32 +++++++---------- dlls/d3d8/device.c | 4 +-- dlls/d3d8/stateblock.c | 2 +- dlls/d3d8/vertexbuffer.c | 2 +- dlls/d3dx8/d3dxbuffer.c | 2 +- dlls/dbghelp/msc.c | 5 ++- dlls/dbghelp/stabs.c | 2 +- dlls/ddraw/d3dexecutebuffer.c | 12 +++---- dlls/ddraw/d3dtexture.c | 3 +- dlls/devenum/mediacatenum.c | 3 +- dlls/dinput/joystick_linux.c | 36 +++++++------------ dlls/dinput/joystick_linuxinput.c | 3 +- dlls/dinput/keyboard.c | 3 +- dlls/dinput/mouse.c | 3 +- dlls/dmscript/script.c | 8 ++--- dlls/dplayx/dplay.c | 11 ++---- dlls/dplayx/dplaysp.c | 24 +++---------- dlls/dsound/buffer.c | 20 ++++------- dlls/dsound/capture.c | 26 +++++--------- dlls/dsound/primary.c | 6 ++-- dlls/gdi/bitmap.c | 3 +- dlls/gdi/dc.c | 4 +-- dlls/gdi/driver.c | 2 +- dlls/gdi/font.c | 5 ++- dlls/gdi/freetype.c | 8 ++--- dlls/gdi/gdi16.c | 2 +- dlls/gdi/metafile.c | 2 +- dlls/gdi/mfdrv/init.c | 2 +- dlls/gdi/mfdrv/text.c | 2 +- dlls/gdi/palette.c | 8 ++--- dlls/gdi/path.c | 4 +-- dlls/gdi/printdrv.c | 9 ++--- dlls/imm32/imm.c | 7 ++-- dlls/iphlpapi/ifenum.c | 12 +++---- dlls/kernel/comm.c | 3 +- dlls/kernel/console.c | 4 +-- dlls/kernel/editline.c | 11 +++--- dlls/kernel/environ.c | 2 +- dlls/kernel/file.c | 2 +- dlls/kernel/file16.c | 2 +- dlls/kernel/format_msg.c | 4 +-- dlls/kernel/global16.c | 2 +- dlls/kernel/lcformat.c | 6 ++-- dlls/kernel/local16.c | 2 +- dlls/kernel/locale.c | 6 ++-- dlls/kernel/ne_module.c | 16 ++++----- dlls/kernel/path.c | 8 ++--- dlls/kernel/process.c | 10 +++--- dlls/kernel/profile.c | 12 +++---- dlls/kernel/resource.c | 20 +++++------ dlls/kernel/sync.c | 6 ++-- dlls/kernel/tests/alloc.c | 4 +-- dlls/kernel/time.c | 3 +- dlls/kernel/volume.c | 10 +++--- dlls/lzexpand/lzexpand_main.c | 2 +- dlls/mpr/wnet.c | 9 ++--- dlls/msacm/internal.c | 6 ++-- dlls/msdmo/dmoreg.c | 7 ++-- dlls/msvcrt/data.c | 12 +++---- dlls/msvcrt/main.c | 2 +- dlls/msvideo/drawdib.c | 21 ++++------- dlls/msvideo/mciwnd.c | 7 ++-- dlls/msvideo/msvideo_main.c | 8 ++--- dlls/netapi32/nbnamecache.c | 3 +- dlls/ole32/bindctx.c | 6 ++-- dlls/ole32/clipboard.c | 3 +- dlls/ole32/datacache.c | 3 +- dlls/ole32/defaulthandler.c | 30 +++++----------- dlls/ole32/filemoniker.c | 7 ++-- dlls/ole32/itemmoniker.c | 8 ++--- dlls/ole32/ole2.c | 3 +- dlls/ole32/storage32.c | 20 +++-------- dlls/oleaut32/olefont.c | 6 ++-- dlls/oleaut32/olepicture.c | 2 +- dlls/oleaut32/typelib2.c | 6 ++-- dlls/opengl32/wgl.c | 12 +++---- dlls/quartz/memallocator.c | 3 +- dlls/richedit/reader.c | 3 +- dlls/rpcrt4/rpc_binding.c | 2 +- dlls/rpcrt4/rpc_message.c | 7 ++-- dlls/rpcrt4/rpc_server.c | 2 +- dlls/rsaenh/handle.c | 3 +- dlls/rsaenh/rsaenh.c | 8 ++--- dlls/serialui/confdlg.c | 3 +- dlls/setupapi/parser.c | 3 +- dlls/setupapi/setupx_main.c | 6 ++-- dlls/shell32/autocomplete.c | 6 ++-- dlls/shell32/brsfolder.c | 5 +-- dlls/shell32/pidl.c | 2 +- dlls/shell32/shell32_main.c | 4 +-- dlls/shell32/shelllink.c | 57 +++++++++--------------------- dlls/shell32/shlexec.c | 2 +- dlls/shell32/shlfileop.c | 3 +- dlls/shlwapi/msgbox.c | 3 +- dlls/shlwapi/ordinal.c | 2 +- dlls/shlwapi/regstream.c | 9 ++--- dlls/urlmon/umon.c | 7 ++-- dlls/user/button.c | 2 +- dlls/user/combo.c | 6 ++-- dlls/user/edit.c | 9 ++--- dlls/user/listbox.c | 6 ++-- dlls/user/lstr.c | 2 +- dlls/user/menu.c | 5 ++- dlls/user/message.c | 8 ++--- dlls/vnbt.vxd/vnbt.c | 6 ++-- dlls/wined3d/indexbuffer.c | 2 +- dlls/wined3d/vertexbuffer.c | 2 +- dlls/winedos/vga.c | 3 +- dlls/wineps/clipping.c | 2 +- dlls/wineps/escape.c | 7 ++-- dlls/wineps/init.c | 15 +++----- dlls/wineps/ppd.c | 10 +++--- dlls/wineps/type42.c | 4 +-- dlls/wininet/cookie.c | 12 +++---- dlls/wininet/ftp.c | 14 +++----- dlls/wininet/http.c | 32 ++++++----------- dlls/wininet/internet.c | 23 ++++-------- dlls/winmm/driver.c | 4 +-- dlls/winmm/mci.c | 8 ++--- dlls/winmm/mciavi/mciavi.c | 16 ++++----- dlls/winmm/mciwave/mciwave.c | 3 +- dlls/winmm/playsound.c | 4 +-- dlls/winmm/winealsa/midi.c | 6 ++-- dlls/winmm/winearts/audio.c | 8 ++--- dlls/winmm/wineoss/dscapture.c | 3 +- dlls/winmm/wineoss/dsrender.c | 3 +- dlls/winmm/wineoss/midi.c | 6 ++-- dlls/winsock/socket.c | 8 ++--- dlls/winsock/socket16.c | 6 ++-- dlls/winspool/info.c | 7 ++-- dlls/x11drv/dib.c | 14 ++++---- dlls/x11drv/palette.c | 2 +- dlls/x11drv/text.c | 2 +- dlls/x11drv/xfont.c | 7 ++-- dlls/x11drv/xrandr.c | 14 +++----- dlls/x11drv/xrender.c | 3 +- programs/regedit/regproc.c | 3 +- programs/rundll32/rundll32.c | 3 +- programs/winecfg/appdefaults.c | 2 +- programs/winecfg/driveui.c | 12 +++---- programs/winecfg/winecfg.c | 6 ++-- programs/wineconsole/dialog.c | 2 +- programs/wineconsole/wineconsole.c | 2 +- programs/winedbg/stack.c | 2 +- programs/winemenubuilder/winemenubuilder.c | 9 ++--- programs/winhelp/hlpfile.c | 14 ++++---- programs/winhelp/macro.lex.l | 7 ++-- windows/cursoricon.c | 4 +-- windows/defwnd.c | 10 +++--- windows/mdi.c | 6 ++-- windows/win.c | 6 ++-- windows/winproc.c | 4 +-- 162 files changed, 445 insertions(+), 764 deletions(-) diff --git a/dlls/advapi32/registry.c b/dlls/advapi32/registry.c index 3ecd09e41a3..4544a37434c 100644 --- a/dlls/advapi32/registry.c +++ b/dlls/advapi32/registry.c @@ -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 ); } diff --git a/dlls/advapi32/security.c b/dlls/advapi32/security.c index bc23d92a465..8d06d907d13 100644 --- a/dlls/advapi32/security.c +++ b/dlls/advapi32/security.c @@ -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; } diff --git a/dlls/advapi32/service.c b/dlls/advapi32/service.c index 404d51ebd91..66a1692fee9 100644 --- a/dlls/advapi32/service.c +++ b/dlls/advapi32/service.c @@ -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 ); diff --git a/dlls/comctl32/animate.c b/dlls/comctl32/animate.c index 374b3b1111c..d26efce0255 100644 --- a/dlls/comctl32/animate.c +++ b/dlls/comctl32/animate.c @@ -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); diff --git a/dlls/comctl32/syslink.c b/dlls/comctl32/syslink.c index aad3e072c1e..dd82e02b4ec 100644 --- a/dlls/comctl32/syslink.c +++ b/dlls/comctl32/syslink.c @@ -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) diff --git a/dlls/comctl32/toolbar.c b/dlls/comctl32/toolbar.c index ebd7f8df388..2172c8519d3 100644 --- a/dlls/comctl32/toolbar.c +++ b/dlls/comctl32/toolbar.c @@ -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; diff --git a/dlls/commdlg/filedlg.c b/dlls/commdlg/filedlg.c index 751384de70f..64530ee1ba5 100644 --- a/dlls/commdlg/filedlg.c +++ b/dlls/commdlg/filedlg.c @@ -3358,10 +3358,7 @@ static void *MemAlloc(UINT size) static void MemFree(void *mem) { - if(mem) - { - HeapFree(GetProcessHeap(),0,mem); - } + HeapFree(GetProcessHeap(),0,mem); } /* diff --git a/dlls/commdlg/filedlg31.c b/dlls/commdlg/filedlg31.c index 9a198220630..af45ed627b7 100644 --- a/dlls/commdlg/filedlg31.c +++ b/dlls/commdlg/filedlg31.c @@ -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); } diff --git a/dlls/commdlg/fontdlg.c b/dlls/commdlg/fontdlg.c index 76f1c491e7d..cec484f5530 100644 --- a/dlls/commdlg/fontdlg.c +++ b/dlls/commdlg/fontdlg.c @@ -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); diff --git a/dlls/commdlg/fontdlg16.c b/dlls/commdlg/fontdlg16.c index 120910b3d3f..18bb83edad4 100644 --- a/dlls/commdlg/fontdlg16.c +++ b/dlls/commdlg/fontdlg16.c @@ -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; } diff --git a/dlls/commdlg/printdlg.c b/dlls/commdlg/printdlg.c index 4d80352e407..1ee53c4941d 100644 --- a/dlls/commdlg/printdlg.c +++ b/dlls/commdlg/printdlg.c @@ -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) { diff --git a/dlls/d3d8/device.c b/dlls/d3d8/device.c index 246c8d6da4d..5b487d344f6 100644 --- a/dlls/d3d8/device.c +++ b/dlls/d3d8/device.c @@ -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 )); } diff --git a/dlls/d3d8/stateblock.c b/dlls/d3d8/stateblock.c index 3da6200e0f2..ac783fb6ca8 100644 --- a/dlls/d3d8/stateblock.c +++ b/dlls/d3d8/stateblock.c @@ -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; } diff --git a/dlls/d3d8/vertexbuffer.c b/dlls/d3d8/vertexbuffer.c index 4129bd165fd..bd12927b219 100644 --- a/dlls/d3d8/vertexbuffer.c +++ b/dlls/d3d8/vertexbuffer.c @@ -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; diff --git a/dlls/d3dx8/d3dxbuffer.c b/dlls/d3dx8/d3dxbuffer.c index 86cdf4ae4ea..c84fcbdd3a4 100644 --- a/dlls/d3dx8/d3dxbuffer.c +++ b/dlls/d3dx8/d3dxbuffer.c @@ -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; diff --git a/dlls/dbghelp/msc.c b/dlls/dbghelp/msc.c index 69b3e2034bd..a572853b5cc 100644 --- a/dlls/dbghelp/msc.c +++ b/dlls/dbghelp/msc.c @@ -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; } diff --git a/dlls/dbghelp/stabs.c b/dlls/dbghelp/stabs.c index 0104fdd9829..0c85a5477c5 100644 --- a/dlls/dbghelp/stabs.c +++ b/dlls/dbghelp/stabs.c @@ -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; } diff --git a/dlls/ddraw/d3dexecutebuffer.c b/dlls/ddraw/d3dexecutebuffer.c index 29e36fe6475..909ee6a2b24 100644 --- a/dlls/ddraw/d3dexecutebuffer.c +++ b/dlls/ddraw/d3dexecutebuffer.c @@ -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)) { diff --git a/dlls/ddraw/d3dtexture.c b/dlls/ddraw/d3dtexture.c index 862bcb0e60e..39f32ad0901 100644 --- a/dlls/ddraw/d3dtexture.c +++ b/dlls/ddraw/d3dtexture.c @@ -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) diff --git a/dlls/devenum/mediacatenum.c b/dlls/devenum/mediacatenum.c index d8d0a3f9fa8..d47cfafbeda 100644 --- a/dlls/devenum/mediacatenum.c +++ b/dlls/devenum/mediacatenum.c @@ -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; diff --git a/dlls/dinput/joystick_linux.c b/dlls/dinput/joystick_linux.c index c67c1d7f327..7fc2bc10300 100644 --- a/dlls/dinput/joystick_linux.c +++ b/dlls/dinput/joystick_linux.c @@ -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; } diff --git a/dlls/dinput/joystick_linuxinput.c b/dlls/dinput/joystick_linuxinput.c index 73489793469..18f146716a0 100644 --- a/dlls/dinput/joystick_linuxinput.c +++ b/dlls/dinput/joystick_linuxinput.c @@ -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); diff --git a/dlls/dinput/keyboard.c b/dlls/dinput/keyboard.c index 1a52fbdf760..aa7d8df36d7 100644 --- a/dlls/dinput/keyboard.c +++ b/dlls/dinput/keyboard.c @@ -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)); diff --git a/dlls/dinput/mouse.c b/dlls/dinput/mouse.c index 48ce2e86dcb..9bddd648c5e 100644 --- a/dlls/dinput/mouse.c +++ b/dlls/dinput/mouse.c @@ -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 ); diff --git a/dlls/dmscript/script.c b/dlls/dmscript/script.c index 6640a977273..6b4da3ac9d3 100644 --- a/dlls/dmscript/script.c +++ b/dlls/dmscript/script.c @@ -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; diff --git a/dlls/dplayx/dplay.c b/dlls/dplayx/dplay.c index 16e918d227d..d532344cb72 100644 --- a/dlls/dplayx/dplay.c +++ b/dlls/dplayx/dplay.c @@ -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 ); diff --git a/dlls/dplayx/dplaysp.c b/dlls/dplayx/dplaysp.c index 42f4154d89f..548b281c792 100644 --- a/dlls/dplayx/dplaysp.c +++ b/dlls/dplayx/dplaysp.c @@ -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; } diff --git a/dlls/dsound/buffer.c b/dlls/dsound/buffer.c index 74721c8406d..33358bc73b5 100644 --- a/dlls/dsound/buffer.c +++ b/dlls/dsound/buffer.c @@ -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); diff --git a/dlls/dsound/capture.c b/dlls/dsound/capture.c index 1cd60780771..576abb0f150 100644 --- a/dlls/dsound/capture.c +++ b/dlls/dsound/capture.c @@ -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); } diff --git a/dlls/dsound/primary.c b/dlls/dsound/primary.c index 25be41a32b1..19ec4ede0aa 100644 --- a/dlls/dsound/primary.c +++ b/dlls/dsound/primary.c @@ -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; } diff --git a/dlls/gdi/bitmap.c b/dlls/gdi/bitmap.c index 575637e038e..10d5b0141b1 100644 --- a/dlls/gdi/bitmap.c +++ b/dlls/gdi/bitmap.c @@ -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) { diff --git a/dlls/gdi/dc.c b/dlls/gdi/dc.c index 972d3d49e58..df569248530 100644 --- a/dlls/gdi/dc.c +++ b/dlls/gdi/dc.c @@ -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; } diff --git a/dlls/gdi/driver.c b/dlls/gdi/driver.c index 959fb2402b0..06d569f1075 100644 --- a/dlls/gdi/driver.c +++ b/dlls/gdi/driver.c @@ -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; } diff --git a/dlls/gdi/font.c b/dlls/gdi/font.c index 7a22af9f16f..86c04830d25 100644 --- a/dlls/gdi/font.c +++ b/dlls/gdi/font.c @@ -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; } diff --git a/dlls/gdi/freetype.c b/dlls/gdi/freetype.c index 4ba993ca74f..beca7c478f3 100644 --- a/dlls/gdi/freetype.c +++ b/dlls/gdi/freetype.c @@ -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); } diff --git a/dlls/gdi/gdi16.c b/dlls/gdi/gdi16.c index a1f8f34e064..6e40079a377 100644 --- a/dlls/gdi/gdi16.c +++ b/dlls/gdi/gdi16.c @@ -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; } diff --git a/dlls/gdi/metafile.c b/dlls/gdi/metafile.c index 8ea31369574..bd6aa72bff7 100644 --- a/dlls/gdi/metafile.c +++ b/dlls/gdi/metafile.c @@ -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; } diff --git a/dlls/gdi/mfdrv/init.c b/dlls/gdi/mfdrv/init.c index c76025db3b1..9dd0fde9da4 100644 --- a/dlls/gdi/mfdrv/init.c +++ b/dlls/gdi/mfdrv/init.c @@ -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); diff --git a/dlls/gdi/mfdrv/text.c b/dlls/gdi/mfdrv/text.c index e893c9610b3..e0cea51c3e8 100644 --- a/dlls/gdi/mfdrv/text.c +++ b/dlls/gdi/mfdrv/text.c @@ -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; } diff --git a/dlls/gdi/palette.c b/dlls/gdi/palette.c index ec1e1964b6a..1cab66c9833 100644 --- a/dlls/gdi/palette.c +++ b/dlls/gdi/palette.c @@ -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); diff --git a/dlls/gdi/path.c b/dlls/gdi/path.c index 77cabbae821..113def67c52 100644 --- a/dlls/gdi/path.c +++ b/dlls/gdi/path.c @@ -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 diff --git a/dlls/gdi/printdrv.c b/dlls/gdi/printdrv.c index 6c84d8fb4cb..b9e00fdfb6e 100644 --- a/dlls/gdi/printdrv.c +++ b/dlls/gdi/printdrv.c @@ -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; } diff --git a/dlls/imm32/imm.c b/dlls/imm32/imm.c index 1749db4f0b7..f60cc4ff436 100644 --- a/dlls/imm32/imm.c +++ b/dlls/imm32/imm.c @@ -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; } diff --git a/dlls/iphlpapi/ifenum.c b/dlls/iphlpapi/ifenum.c index fb251ff4c14..58e7b5fe808 100644 --- a/dlls/iphlpapi/ifenum.c +++ b/dlls/iphlpapi/ifenum.c @@ -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); } } diff --git a/dlls/kernel/comm.c b/dlls/kernel/comm.c index 8980debc7b8..a5c8b28f831 100644 --- a/dlls/kernel/comm.c +++ b/dlls/kernel/comm.c @@ -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; } diff --git a/dlls/kernel/console.c b/dlls/kernel/console.c index 322d7b5c049..0a8b76205fa 100644 --- a/dlls/kernel/console.c +++ b/dlls/kernel/console.c @@ -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; diff --git a/dlls/kernel/editline.c b/dlls/kernel/editline.c index d3a231b143c..2df3a7a332e 100644 --- a/dlls/kernel/editline.c +++ b/dlls/kernel/editline.c @@ -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; } diff --git a/dlls/kernel/environ.c b/dlls/kernel/environ.c index 2a8ce09b388..b722c0a255d 100644 --- a/dlls/kernel/environ.c +++ b/dlls/kernel/environ.c @@ -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; } diff --git a/dlls/kernel/file.c b/dlls/kernel/file.c index e1990962371..960935d328c 100644 --- a/dlls/kernel/file.c +++ b/dlls/kernel/file.c @@ -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; } diff --git a/dlls/kernel/file16.c b/dlls/kernel/file16.c index bcd1685c470..c4d1fd1df48 100644 --- a/dlls/kernel/file16.c +++ b/dlls/kernel/file16.c @@ -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; } diff --git a/dlls/kernel/format_msg.c b/dlls/kernel/format_msg.c index 35e9e0049a1..d1144ea9f3b 100644 --- a/dlls/kernel/format_msg.c +++ b/dlls/kernel/format_msg.c @@ -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) ? diff --git a/dlls/kernel/global16.c b/dlls/kernel/global16.c index e4f6b797481..cd7e188b705 100644 --- a/dlls/kernel/global16.c +++ b/dlls/kernel/global16.c @@ -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; } diff --git a/dlls/kernel/lcformat.c b/dlls/kernel/lcformat.c index 8376fcd2c51..6a43cd47d8b 100644 --- a/dlls/kernel/lcformat.c +++ b/dlls/kernel/lcformat.c @@ -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; } diff --git a/dlls/kernel/local16.c b/dlls/kernel/local16.c index 98580fb9ce4..9fe2dbb83f3 100644 --- a/dlls/kernel/local16.c +++ b/dlls/kernel/local16.c @@ -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 ); diff --git a/dlls/kernel/locale.c b/dlls/kernel/locale.c index a0533425fff..9d8ae355585 100644 --- a/dlls/kernel/locale.c +++ b/dlls/kernel/locale.c @@ -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; } diff --git a/dlls/kernel/ne_module.c b/dlls/kernel/ne_module.c index ea4557d26a2..ca4e61f4bc0 100644 --- a/dlls/kernel/ne_module.c +++ b/dlls/kernel/ne_module.c @@ -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 */ diff --git a/dlls/kernel/path.c b/dlls/kernel/path.c index 838b0243ba4..c274237b2b1 100644 --- a/dlls/kernel/path.c +++ b/dlls/kernel/path.c @@ -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; } diff --git a/dlls/kernel/process.c b/dlls/kernel/process.c index a27c936d1d4..53dfdacfb85 100644 --- a/dlls/kernel/process.c +++ b/dlls/kernel/process.c @@ -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; } diff --git a/dlls/kernel/profile.c b/dlls/kernel/profile.c index 1b38e0beebb..1832afb9cdb 100644 --- a/dlls/kernel/profile.c +++ b/dlls/kernel/profile.c @@ -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(§ionW); 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; } diff --git a/dlls/kernel/resource.c b/dlls/kernel/resource.c index ff7e7236d23..58dcb9d7a6a 100644 --- a/dlls/kernel/resource.c +++ b/dlls/kernel/resource.c @@ -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); diff --git a/dlls/kernel/sync.c b/dlls/kernel/sync.c index 9d54e9dfce8..5b7a5435a71 100644 --- a/dlls/kernel/sync.c +++ b/dlls/kernel/sync.c @@ -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; } diff --git a/dlls/kernel/tests/alloc.c b/dlls/kernel/tests/alloc.c index 4c4a23eb36b..f5777f0ccc6 100644 --- a/dlls/kernel/tests/alloc.c +++ b/dlls/kernel/tests/alloc.c @@ -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 */ diff --git a/dlls/kernel/time.c b/dlls/kernel/time.c index ecfab9b10c9..4ad09b24700 100644 --- a/dlls/kernel/time.c +++ b/dlls/kernel/time.c @@ -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; } diff --git a/dlls/kernel/volume.c b/dlls/kernel/volume.c index 7da60e3a5b6..50e0d7dde10 100644 --- a/dlls/kernel/volume.c +++ b/dlls/kernel/volume.c @@ -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; } diff --git a/dlls/lzexpand/lzexpand_main.c b/dlls/lzexpand/lzexpand_main.c index 0eb39e68227..ee42dd9b614 100644 --- a/dlls/lzexpand/lzexpand_main.c +++ b/dlls/lzexpand/lzexpand_main.c @@ -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 ); diff --git a/dlls/mpr/wnet.c b/dlls/mpr/wnet.c index 25630309056..e754156f268 100644 --- a/dlls/mpr/wnet.c +++ b/dlls/mpr/wnet.c @@ -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); } } diff --git a/dlls/msacm/internal.c b/dlls/msacm/internal.c index 0a06473880b..faa47ff4378 100644 --- a/dlls/msacm/internal.c +++ b/dlls/msacm/internal.c @@ -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) diff --git a/dlls/msdmo/dmoreg.c b/dlls/msdmo/dmoreg.c index ba1fdd5101b..51d8430b59e 100644 --- a/dlls/msdmo/dmoreg.c +++ b/dlls/msdmo/dmoreg.c @@ -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; } diff --git a/dlls/msvcrt/data.c b/dlls/msvcrt/data.c index 746c2d756ad..1e9c24b6950 100644 --- a/dlls/msvcrt/data.c +++ b/dlls/msvcrt/data.c @@ -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); } /********************************************************************* diff --git a/dlls/msvcrt/main.c b/dlls/msvcrt/main.c index ab7d2d7d965..4297bb8e580 100644 --- a/dlls/msvcrt/main.c +++ b/dlls/msvcrt/main.c @@ -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; } diff --git a/dlls/msvideo/drawdib.c b/dlls/msvideo/drawdib.c index f251960c04d..47dd99cca32 100644 --- a/dlls/msvideo/drawdib.c +++ b/dlls/msvideo/drawdib.c @@ -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; diff --git a/dlls/msvideo/mciwnd.c b/dlls/msvideo/mciwnd.c index 9260c01e719..eb8d376a4f1 100644 --- a/dlls/msvideo/mciwnd.c +++ b/dlls/msvideo/mciwnd.c @@ -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); diff --git a/dlls/msvideo/msvideo_main.c b/dlls/msvideo/msvideo_main.c index 32f852e94a9..14e5aeb0f93 100644 --- a/dlls/msvideo/msvideo_main.c +++ b/dlls/msvideo/msvideo_main.c @@ -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 ) diff --git a/dlls/netapi32/nbnamecache.c b/dlls/netapi32/nbnamecache.c index f536e864eb8..ca4f15c963e 100644 --- a/dlls/netapi32/nbnamecache.c +++ b/dlls/netapi32/nbnamecache.c @@ -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; } diff --git a/dlls/ole32/bindctx.c b/dlls/ole32/bindctx.c index d7cc892e72e..e13d2a9a942 100644 --- a/dlls/ole32/bindctx.c +++ b/dlls/ole32/bindctx.c @@ -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; jbindCtxTableLastIndex-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; jbindCtxTableLastIndex-1; j++) diff --git a/dlls/ole32/clipboard.c b/dlls/ole32/clipboard.c index 4466421074b..74156e8842c 100644 --- a/dlls/ole32/clipboard.c +++ b/dlls/ole32/clipboard.c @@ -1489,8 +1489,7 @@ CLEANUP: /* * Free the array of FORMATETC's */ - if (afmt) - HeapFree(GetProcessHeap(), 0, afmt); + HeapFree(GetProcessHeap(), 0, afmt); /* * Close Windows clipboard diff --git a/dlls/ole32/datacache.c b/dlls/ole32/datacache.c index d5e6ed6eb2e..e739f429036 100644 --- a/dlls/ole32/datacache.c +++ b/dlls/ole32/datacache.c @@ -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); diff --git a/dlls/ole32/defaulthandler.c b/dlls/ole32/defaulthandler.c index 956709cda1b..205000d3ed7 100644 --- a/dlls/ole32/defaulthandler.c +++ b/dlls/ole32/defaulthandler.c @@ -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. diff --git a/dlls/ole32/filemoniker.c b/dlls/ole32/filemoniker.c index 8e71c3f7733..3388ff858c2 100644 --- a/dlls/ole32/filemoniker.c +++ b/dlls/ole32/filemoniker.c @@ -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; diff --git a/dlls/ole32/itemmoniker.c b/dlls/ole32/itemmoniker.c index c30c2b528d7..193b4032640 100644 --- a/dlls/ole32/itemmoniker.c +++ b/dlls/ole32/itemmoniker.c @@ -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; diff --git a/dlls/ole32/ole2.c b/dlls/ole32/ole2.c index d869be7c443..b1dbce3330b 100644 --- a/dlls/ole32/ole2.c +++ b/dlls/ole32/ole2.c @@ -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; } diff --git a/dlls/ole32/storage32.c b/dlls/ole32/storage32.c index 21d2e51b5ae..cf8cd1ae745 100644 --- a/dlls/ole32/storage32.c +++ b/dlls/ole32/storage32.c @@ -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; diff --git a/dlls/oleaut32/olefont.c b/dlls/oleaut32/olefont.c index 0823feee766..afad3b80559 100644 --- a/dlls/oleaut32/olefont.c +++ b/dlls/oleaut32/olefont.c @@ -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) ); diff --git a/dlls/oleaut32/olepicture.c b/dlls/oleaut32/olepicture.c index 6a99f5b1684..cb3931f716b 100644 --- a/dlls/oleaut32/olepicture.c +++ b/dlls/oleaut32/olepicture.c @@ -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); } diff --git a/dlls/oleaut32/typelib2.c b/dlls/oleaut32/typelib2.c index c83eb169a9d..4bfb064c6d9 100644 --- a/dlls/oleaut32/typelib2.c +++ b/dlls/oleaut32/typelib2.c @@ -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; diff --git a/dlls/opengl32/wgl.c b/dlls/opengl32/wgl.c index ce627f9f6ae..b9724e5db1f 100644 --- a/dlls/opengl32/wgl.c +++ b/dlls/opengl32/wgl.c @@ -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; } diff --git a/dlls/quartz/memallocator.c b/dlls/quartz/memallocator.c index 7c8877d1837..c83b9e25461 100644 --- a/dlls/quartz/memallocator.c +++ b/dlls/quartz/memallocator.c @@ -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; } diff --git a/dlls/richedit/reader.c b/dlls/richedit/reader.c index 5da908309eb..b4368d0570a 100644 --- a/dlls/richedit/reader.c +++ b/dlls/richedit/reader.c @@ -2546,8 +2546,7 @@ char *p; void RTFFree(char *p) { - if (p != (char *) NULL) - HeapFree(RICHED32_hHeap, 0, p); + HeapFree(RICHED32_hHeap, 0, p); } diff --git a/dlls/rpcrt4/rpc_binding.c b/dlls/rpcrt4/rpc_binding.c index 72b2732b73e..954c17e3626 100644 --- a/dlls/rpcrt4/rpc_binding.c +++ b/dlls/rpcrt4/rpc_binding.c @@ -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) diff --git a/dlls/rpcrt4/rpc_message.c b/dlls/rpcrt4/rpc_message.c index 3a87fcd4e38..cd87c48ef71 100644 --- a/dlls/rpcrt4/rpc_message.c +++ b/dlls/rpcrt4/rpc_message.c @@ -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; } diff --git a/dlls/rpcrt4/rpc_server.c b/dlls/rpcrt4/rpc_server.c index f4cfc58b57d..e14fa39bb52 100644 --- a/dlls/rpcrt4/rpc_server.c +++ b/dlls/rpcrt4/rpc_server.c @@ -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; } diff --git a/dlls/rsaenh/handle.c b/dlls/rsaenh/handle.c index 13589ecad79..d7c990f17a9 100644 --- a/dlls/rsaenh/handle.c +++ b/dlls/rsaenh/handle.c @@ -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); } diff --git a/dlls/rsaenh/rsaenh.c b/dlls/rsaenh/rsaenh.c index 5d089d69f3c..f08f0dca10c 100644 --- a/dlls/rsaenh/rsaenh.c +++ b/dlls/rsaenh/rsaenh.c @@ -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; } diff --git a/dlls/serialui/confdlg.c b/dlls/serialui/confdlg.c index dc4be4ffdf1..203eb73b709 100644 --- a/dlls/serialui/confdlg.c +++ b/dlls/serialui/confdlg.c @@ -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 ); } /*********************************************************************** diff --git a/dlls/setupapi/parser.c b/dlls/setupapi/parser.c index 9c6d4fc41df..53c9e3968b8 100644 --- a/dlls/setupapi/parser.c +++ b/dlls/setupapi/parser.c @@ -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; } diff --git a/dlls/setupapi/setupx_main.c b/dlls/setupapi/setupx_main.c index ca3ac711792..8610ce0a55f 100644 --- a/dlls/setupapi/setupx_main.c +++ b/dlls/setupapi/setupx_main.c @@ -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)); diff --git a/dlls/shell32/autocomplete.c b/dlls/shell32/autocomplete.c index f314f465fb0..93e2b1f0718 100644 --- a/dlls/shell32/autocomplete.c +++ b/dlls/shell32/autocomplete.c @@ -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) diff --git a/dlls/shell32/brsfolder.c b/dlls/shell32/brsfolder.c index bd8758469dd..d2b27dbc762 100644 --- a/dlls/shell32/brsfolder.c +++ b/dlls/shell32/brsfolder.c @@ -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; } diff --git a/dlls/shell32/pidl.c b/dlls/shell32/pidl.c index fd78933e1fb..f77343c7453 100644 --- a/dlls/shell32/pidl.c +++ b/dlls/shell32/pidl.c @@ -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; } diff --git a/dlls/shell32/shell32_main.c b/dlls/shell32/shell32_main.c index 53047fd0136..4db5c7bd047 100644 --- a/dlls/shell32/shell32_main.c +++ b/dlls/shell32/shell32_main.c @@ -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; } diff --git a/dlls/shell32/shelllink.c b/dlls/shell32/shelllink.c index 846d18957b8..e0272646ecb 100644 --- a/dlls/shell32/shelllink.c +++ b/dlls/shell32/shelllink.c @@ -993,20 +993,11 @@ static ULONG WINAPI IShellLinkA_fnRelease(IShellLinkA * iface) TRACE("-- destroying IShellLink(%p)\n",This); - if (This->sIcoPath) - HeapFree(GetProcessHeap(), 0, This->sIcoPath); - - if (This->sArgs) - HeapFree(GetProcessHeap(), 0, This->sArgs); - - if (This->sWorkDir) - HeapFree(GetProcessHeap(), 0, This->sWorkDir); - - if (This->sDescription) - HeapFree(GetProcessHeap(), 0, This->sDescription); - - if (This->sPath) - HeapFree(GetProcessHeap(),0,This->sPath); + HeapFree(GetProcessHeap(), 0, This->sIcoPath); + HeapFree(GetProcessHeap(), 0, This->sArgs); + HeapFree(GetProcessHeap(), 0, This->sWorkDir); + HeapFree(GetProcessHeap(), 0, This->sDescription); + HeapFree(GetProcessHeap(),0,This->sPath); if (This->pPidl) ILFree(This->pPidl); @@ -1080,8 +1071,7 @@ static HRESULT WINAPI IShellLinkA_fnSetDescription(IShellLinkA * iface, LPCSTR p TRACE("(%p)->(pName=%s)\n", This, pszName); - if (This->sDescription) - HeapFree(GetProcessHeap(), 0, This->sDescription); + HeapFree(GetProcessHeap(), 0, This->sDescription); This->sDescription = HEAP_strdupAtoW( GetProcessHeap(), 0, pszName); if ( !This->sDescription ) return E_OUTOFMEMORY; @@ -1112,8 +1102,7 @@ static HRESULT WINAPI IShellLinkA_fnSetWorkingDirectory(IShellLinkA * iface, LPC TRACE("(%p)->(dir=%s)\n",This, pszDir); - if (This->sWorkDir) - HeapFree(GetProcessHeap(), 0, This->sWorkDir); + HeapFree(GetProcessHeap(), 0, This->sWorkDir); This->sWorkDir = HEAP_strdupAtoW( GetProcessHeap(), 0, pszDir); if ( !This->sWorkDir ) return E_OUTOFMEMORY; @@ -1144,8 +1133,7 @@ static HRESULT WINAPI IShellLinkA_fnSetArguments(IShellLinkA * iface, LPCSTR psz TRACE("(%p)->(args=%s)\n",This, pszArgs); - if (This->sArgs) - HeapFree(GetProcessHeap(), 0, This->sArgs); + HeapFree(GetProcessHeap(), 0, This->sArgs); This->sArgs = HEAP_strdupAtoW( GetProcessHeap(), 0, pszArgs); if( !This->sArgs ) return E_OUTOFMEMORY; @@ -1276,8 +1264,7 @@ static HRESULT WINAPI IShellLinkA_fnSetIconLocation(IShellLinkA * iface, LPCSTR TRACE("(%p)->(path=%s iicon=%u)\n",This, pszIconPath, iIcon); - if (This->sIcoPath) - HeapFree(GetProcessHeap(), 0, This->sIcoPath); + HeapFree(GetProcessHeap(), 0, This->sIcoPath); This->sIcoPath = HEAP_strdupAtoW(GetProcessHeap(), 0, pszIconPath); if ( !This->sIcoPath ) return E_OUTOFMEMORY; @@ -1294,8 +1281,7 @@ static HRESULT WINAPI IShellLinkA_fnSetRelativePath(IShellLinkA * iface, LPCSTR FIXME("(%p)->(path=%s %lx)\n",This, pszPathRel, dwReserved); - if (This->sPathRel) - HeapFree(GetProcessHeap(), 0, This->sPathRel); + HeapFree(GetProcessHeap(), 0, This->sPathRel); This->sPathRel = HEAP_strdupAtoW(GetProcessHeap(), 0, pszPathRel); This->bDirty = TRUE; @@ -1354,9 +1340,7 @@ static HRESULT WINAPI IShellLinkA_fnSetPath(IShellLinkA * iface, LPCSTR pszFile) if (!GetFullPathNameA(pszFile, MAX_PATH, buffer, &fname)) return E_FAIL; - if (This->sPath) - HeapFree(GetProcessHeap(), 0, This->sPath); - + HeapFree(GetProcessHeap(), 0, This->sPath); This->sPath = HEAP_strdupAtoW(GetProcessHeap(), 0, buffer); if( !This->sPath ) return E_OUTOFMEMORY; @@ -1499,8 +1483,7 @@ static HRESULT WINAPI IShellLinkW_fnSetDescription(IShellLinkW * iface, LPCWSTR TRACE("(%p)->(desc=%s)\n",This, debugstr_w(pszName)); - if (This->sDescription) - HeapFree(GetProcessHeap(), 0, This->sDescription); + HeapFree(GetProcessHeap(), 0, This->sDescription); This->sDescription = HeapAlloc( GetProcessHeap(), 0, (lstrlenW( pszName )+1)*sizeof(WCHAR) ); if ( !This->sDescription ) @@ -1532,8 +1515,7 @@ static HRESULT WINAPI IShellLinkW_fnSetWorkingDirectory(IShellLinkW * iface, LPC TRACE("(%p)->(dir=%s)\n",This, debugstr_w(pszDir)); - if (This->sWorkDir) - HeapFree(GetProcessHeap(), 0, This->sWorkDir); + HeapFree(GetProcessHeap(), 0, This->sWorkDir); This->sWorkDir = HeapAlloc( GetProcessHeap(), 0, (lstrlenW( pszDir )+1)*sizeof (WCHAR) ); if ( !This->sWorkDir ) @@ -1564,8 +1546,7 @@ static HRESULT WINAPI IShellLinkW_fnSetArguments(IShellLinkW * iface, LPCWSTR ps TRACE("(%p)->(args=%s)\n",This, debugstr_w(pszArgs)); - if (This->sArgs) - HeapFree(GetProcessHeap(), 0, This->sArgs); + HeapFree(GetProcessHeap(), 0, This->sArgs); This->sArgs = HeapAlloc( GetProcessHeap(), 0, (lstrlenW( pszArgs )+1)*sizeof (WCHAR) ); if ( !This->sArgs ) @@ -1697,8 +1678,7 @@ static HRESULT WINAPI IShellLinkW_fnSetIconLocation(IShellLinkW * iface, LPCWSTR TRACE("(%p)->(path=%s iicon=%u)\n",This, debugstr_w(pszIconPath), iIcon); - if (This->sIcoPath) - HeapFree(GetProcessHeap(), 0, This->sIcoPath); + HeapFree(GetProcessHeap(), 0, This->sIcoPath); This->sIcoPath = HeapAlloc( GetProcessHeap(), 0, (lstrlenW( pszIconPath )+1)*sizeof (WCHAR) ); if ( !This->sIcoPath ) @@ -1717,8 +1697,7 @@ static HRESULT WINAPI IShellLinkW_fnSetRelativePath(IShellLinkW * iface, LPCWSTR TRACE("(%p)->(path=%s %lx)\n",This, debugstr_w(pszPathRel), dwReserved); - if (This->sPathRel) - HeapFree(GetProcessHeap(), 0, This->sPathRel); + HeapFree(GetProcessHeap(), 0, This->sPathRel); This->sPathRel = HeapAlloc( GetProcessHeap(), 0, (lstrlenW( pszPathRel )+1) * sizeof (WCHAR) ); if ( !This->sPathRel ) @@ -1781,9 +1760,7 @@ static HRESULT WINAPI IShellLinkW_fnSetPath(IShellLinkW * iface, LPCWSTR pszFile if (!GetFullPathNameW(pszFile, MAX_PATH, buffer, &fname)) return E_FAIL; - if (This->sPath) - HeapFree(GetProcessHeap(), 0, This->sPath); - + HeapFree(GetProcessHeap(), 0, This->sPath); This->sPath = HeapAlloc( GetProcessHeap(), 0, (lstrlenW( buffer )+1) * sizeof (WCHAR) ); if (!This->sPath) diff --git a/dlls/shell32/shlexec.c b/dlls/shell32/shlexec.c index f87b1a3756b..14bab166d5f 100644 --- a/dlls/shell32/shlexec.c +++ b/dlls/shell32/shlexec.c @@ -1279,7 +1279,7 @@ BOOL WINAPI ShellExecuteExW32 (LPSHELLEXECUTEINFOW sei, SHELL_ExecuteW32 execfun retval = execute_from_key(lpstrProtocol, wszApplicationName, env, sei_tmp.lpParameters, execfunc, &sei_tmp, sei); else retval = execfunc(wszQuotedCmd, env, FALSE, &sei_tmp, sei); - if (env) HeapFree( GetProcessHeap(), 0, env ); + HeapFree( GetProcessHeap(), 0, env ); } else if (PathIsURLW((LPWSTR)lpFile)) /* File not found, check for URL */ { diff --git a/dlls/shell32/shlfileop.c b/dlls/shell32/shlfileop.c index f1c4af8717d..f229819b73b 100644 --- a/dlls/shell32/shlfileop.c +++ b/dlls/shell32/shlfileop.c @@ -1335,8 +1335,7 @@ shfileop_end: if (hFind != INVALID_HANDLE_VALUE) FindClose(hFind); hFind = INVALID_HANDLE_VALUE; - if (pTempFrom) - HeapFree(GetProcessHeap(), 0, pTempFrom); + HeapFree(GetProcessHeap(), 0, pTempFrom); if (retCode) nFileOp.fAnyOperationsAborted = TRUE; TRACE("%s level=%ld AnyOpsAborted=%s ret=0x%x, with %s %s%s\n", diff --git a/dlls/shlwapi/msgbox.c b/dlls/shlwapi/msgbox.c index 1f92ffb0aa2..1f5957cfef4 100644 --- a/dlls/shlwapi/msgbox.c +++ b/dlls/shlwapi/msgbox.c @@ -273,8 +273,7 @@ INT_PTR WINAPI SHMessageBoxCheckA(HWND hWnd, LPCSTR lpszText, LPCSTR lpszTitle, iRetVal = SHMessageBoxCheckW(hWnd, szTextBuff, lpszTitle ? szTitleBuff : NULL, dwType, iRet, szIdBuff); - if (szTextBuff) - HeapFree(GetProcessHeap(), 0, szTextBuff); + HeapFree(GetProcessHeap(), 0, szTextBuff); return iRetVal; } diff --git a/dlls/shlwapi/ordinal.c b/dlls/shlwapi/ordinal.c index 8d4042189f2..03afcab9d9a 100644 --- a/dlls/shlwapi/ordinal.c +++ b/dlls/shlwapi/ordinal.c @@ -608,7 +608,7 @@ HRESULT WINAPI GetAcceptLanguagesA( LPSTR langbuf, LPDWORD buflen) *buflen, NULL, NULL); *buflen = buflenW ? convlen : 0; - if(langbufW) HeapFree(GetProcessHeap(), 0, langbufW); + HeapFree(GetProcessHeap(), 0, langbufW); return retval; } diff --git a/dlls/shlwapi/regstream.c b/dlls/shlwapi/regstream.c index 614c70bd1b0..384c61a0726 100644 --- a/dlls/shlwapi/regstream.c +++ b/dlls/shlwapi/regstream.c @@ -94,8 +94,7 @@ static ULONG WINAPI IStream_fnRelease(IStream *iface) { TRACE(" destroying SHReg IStream (%p)\n",This); - if (This->pbBuffer) - HeapFree(GetProcessHeap(),0,This->pbBuffer); + HeapFree(GetProcessHeap(),0,This->pbBuffer); if (This->hKey) RegCloseKey(This->hKey); @@ -388,8 +387,7 @@ IStream * WINAPI SHOpenRegStream2A(HKEY hKey, LPCSTR pszSubkey, dwType == REG_BINARY) return IStream_Create(hStrKey, lpBuff, dwLength); - if (lpBuff) - HeapFree (GetProcessHeap(), 0, lpBuff); + HeapFree (GetProcessHeap(), 0, lpBuff); if (hStrKey) RegCloseKey(hStrKey); return NULL; @@ -418,8 +416,7 @@ IStream * WINAPI SHOpenRegStream2W(HKEY hKey, LPCWSTR pszSubkey, dwType == REG_BINARY) return IStream_Create(hStrKey, lpBuff, dwLength); - if (lpBuff) - HeapFree (GetProcessHeap(), 0, lpBuff); + HeapFree (GetProcessHeap(), 0, lpBuff); if (hStrKey) RegCloseKey(hStrKey); return NULL; diff --git a/dlls/urlmon/umon.c b/dlls/urlmon/umon.c index 266c94f848e..dba3c4a6fc7 100644 --- a/dlls/urlmon/umon.c +++ b/dlls/urlmon/umon.c @@ -123,9 +123,7 @@ static ULONG WINAPI URLMonikerImpl_Release(IMoniker* iface) /* destroy the object if there's no more reference on it */ if (ref == 0) { - if (This->URLName!=NULL) - HeapFree(GetProcessHeap(),0,This->URLName); - + HeapFree(GetProcessHeap(),0,This->URLName); HeapFree(GetProcessHeap(),0,This); } @@ -186,8 +184,7 @@ static HRESULT WINAPI URLMonikerImpl_Load(IMoniker* iface,IStream* pStm) res = IStream_Read(pStm, &len, sizeof(ULONG), &got); if(SUCCEEDED(res)) { if(got == sizeof(ULONG)) { - if(This->URLName) - HeapFree(GetProcessHeap(), 0, This->URLName); + HeapFree(GetProcessHeap(), 0, This->URLName); This->URLName=HeapAlloc(GetProcessHeap(),0,sizeof(WCHAR)*(len+1)); if(!This->URLName) res = E_OUTOFMEMORY; diff --git a/dlls/user/button.c b/dlls/user/button.c index 676e67d952a..d486ef05ce5 100644 --- a/dlls/user/button.c +++ b/dlls/user/button.c @@ -751,7 +751,7 @@ static void BUTTON_DrawLabel(HWND hwnd, HDC hdc, UINT dtFlags, RECT *rc) DrawStateW(hdc, hbr, lpOutputProc, lp, wp, rc->left, rc->top, rc->right - rc->left, rc->bottom - rc->top, flags); - if (text) HeapFree( GetProcessHeap(), 0, text ); + HeapFree( GetProcessHeap(), 0, text ); } /********************************************************************** diff --git a/dlls/user/combo.c b/dlls/user/combo.c index 36b1435d009..92464cdbf79 100644 --- a/dlls/user/combo.c +++ b/dlls/user/combo.c @@ -831,8 +831,7 @@ static void CBPaintText( if( hPrevFont ) SelectObject(hdc, hPrevFont ); } - if (pText) - HeapFree( GetProcessHeap(), 0, pText ); + HeapFree( GetProcessHeap(), 0, pText ); } /*********************************************************************** @@ -1068,8 +1067,7 @@ static void CBUpdateEdit( LPHEADCOMBO lphc , INT index ) if( lphc->wState & CBF_FOCUSED ) SendMessageW(lphc->hWndEdit, EM_SETSEL, 0, (LPARAM)(-1)); - if( pText ) - HeapFree( GetProcessHeap(), 0, pText ); + HeapFree( GetProcessHeap(), 0, pText ); } /*********************************************************************** diff --git a/dlls/user/edit.c b/dlls/user/edit.c index 4d7871b711b..0d2ac38e7cb 100644 --- a/dlls/user/edit.c +++ b/dlls/user/edit.c @@ -864,8 +864,7 @@ static LRESULT WINAPI EditWndProc_common( HWND hwnd, UINT msg, MultiByteToWideChar(CP_ACP, 0, nameA, -1, nameW, countW); } result = EDIT_WM_Create(es, nameW); - if(nameW) - HeapFree(GetProcessHeap(), 0, nameW); + HeapFree(GetProcessHeap(), 0, nameW); } break; @@ -3527,8 +3526,7 @@ static BOOL EDIT_EM_SetTabStops(EDITSTATE *es, INT count, LPINT tabs) { if (!(es->style & ES_MULTILINE)) return FALSE; - if (es->tabs) - HeapFree(GetProcessHeap(), 0, es->tabs); + HeapFree(GetProcessHeap(), 0, es->tabs); es->tabs_count = count; if (!count) es->tabs = NULL; @@ -3549,8 +3547,7 @@ static BOOL EDIT_EM_SetTabStops16(EDITSTATE *es, INT count, LPINT16 tabs) { if (!(es->style & ES_MULTILINE)) return FALSE; - if (es->tabs) - HeapFree(GetProcessHeap(), 0, es->tabs); + HeapFree(GetProcessHeap(), 0, es->tabs); es->tabs_count = count; if (!count) es->tabs = NULL; diff --git a/dlls/user/listbox.c b/dlls/user/listbox.c index c5285dd0d40..50d4cd3edc6 100644 --- a/dlls/user/listbox.c +++ b/dlls/user/listbox.c @@ -739,7 +739,7 @@ static LRESULT LISTBOX_InitStorage( LB_DESCR *descr, INT nb_items ) static BOOL LISTBOX_SetTabStops( LB_DESCR *descr, INT count, LPINT tabs, BOOL short_ints ) { if (!(descr->style & LBS_USETABSTOPS)) return TRUE; - if (descr->tabs) HeapFree( GetProcessHeap(), 0, descr->tabs ); + HeapFree( GetProcessHeap(), 0, descr->tabs ); if (!(descr->nb_tabs = count)) { descr->tabs = NULL; @@ -1596,7 +1596,7 @@ static LRESULT LISTBOX_InsertString( LB_DESCR *descr, INT index, LPCWSTR str ) if (index == -1) index = descr->nb_items; if ((ret = LISTBOX_InsertItem( descr, index, new_str, data )) != 0) { - if (new_str) HeapFree( GetProcessHeap(), 0, new_str ); + HeapFree( GetProcessHeap(), 0, new_str ); return ret; } @@ -1710,7 +1710,7 @@ static void LISTBOX_ResetContent( LB_DESCR *descr ) INT i; for (i = 0; i < descr->nb_items; i++) LISTBOX_DeleteItem( descr, i ); - if (descr->items) HeapFree( GetProcessHeap(), 0, descr->items ); + HeapFree( GetProcessHeap(), 0, descr->items ); descr->nb_items = 0; descr->top_item = 0; descr->selected_item = -1; diff --git a/dlls/user/lstr.c b/dlls/user/lstr.c index 9750060b9c4..2d49ee1fc90 100644 --- a/dlls/user/lstr.c +++ b/dlls/user/lstr.c @@ -766,7 +766,7 @@ DWORD WINAPI FormatMessage16( } else lstrcpynA(lpBuffer,target,nSize); HeapFree(GetProcessHeap(),0,target); - if (from) HeapFree(GetProcessHeap(),0,from); + HeapFree(GetProcessHeap(),0,from); return (dwFlags & FORMAT_MESSAGE_ALLOCATE_BUFFER) ? strlen(allocstring): strlen(lpBuffer); diff --git a/dlls/user/menu.c b/dlls/user/menu.c index 0b2888df1d7..6cc447055cf 100644 --- a/dlls/user/menu.c +++ b/dlls/user/menu.c @@ -1697,7 +1697,7 @@ static BOOL MENU_SetItemData( MENUITEM *item, UINT flags, UINT_PTR id, /* Don't call SetRectEmpty here! */ - if (prevText) HeapFree( GetProcessHeap(), 0, prevText ); + HeapFree( GetProcessHeap(), 0, prevText ); debug_print_menuitem("MENU_SetItemData to : ", item, ""); return TRUE; @@ -4135,8 +4135,7 @@ static BOOL SetMenuItemInfo_common(MENUITEM * menu, if (lpmii->fMask & MIIM_STRING ) { if (IS_STRING_ITEM(menu->fType)) { /* free the string when used */ - if(menu->text) - HeapFree(GetProcessHeap(), 0, menu->text); + HeapFree(GetProcessHeap(), 0, menu->text); set_menu_item_text( menu, lpmii->dwTypeData, unicode ); } } diff --git a/dlls/user/message.c b/dlls/user/message.c index e60104f21d8..c8f08036481 100644 --- a/dlls/user/message.c +++ b/dlls/user/message.c @@ -1575,7 +1575,7 @@ BOOL MSG_peek_message( MSG *msg, HWND hwnd, UINT first, UINT last, int flags ) } else { - if (buffer) HeapFree( GetProcessHeap(), 0, buffer ); + HeapFree( GetProcessHeap(), 0, buffer ); buffer_size = reply->total; } } @@ -1640,7 +1640,7 @@ BOOL MSG_peek_message( MSG *msg, HWND hwnd, UINT first, UINT last, int flags ) } } *msg = info.msg; - if (buffer) HeapFree( GetProcessHeap(), 0, buffer ); + HeapFree( GetProcessHeap(), 0, buffer ); return TRUE; } @@ -1652,7 +1652,7 @@ BOOL MSG_peek_message( MSG *msg, HWND hwnd, UINT first, UINT last, int flags ) reply_message( &info, result, TRUE ); queue->receive_info = old_info; next: - if (buffer) HeapFree( GetProcessHeap(), 0, buffer ); + HeapFree( GetProcessHeap(), 0, buffer ); } } @@ -1807,7 +1807,7 @@ static LRESULT retrieve_reply( const struct send_message_info *info, if (!status && reply_size) unpack_reply( info->hwnd, info->msg, info->wparam, info->lparam, reply_data, reply_size ); - if (reply_data) HeapFree( GetProcessHeap(), 0, reply_data ); + HeapFree( GetProcessHeap(), 0, reply_data ); TRACE( "hwnd %p msg %x (%s) wp %x lp %lx got reply %lx (err=%ld)\n", info->hwnd, info->msg, SPY_GetMsgName(info->msg, info->hwnd), info->wparam, diff --git a/dlls/vnbt.vxd/vnbt.c b/dlls/vnbt.vxd/vnbt.c index a4e5751864d..1be572de3a4 100644 --- a/dlls/vnbt.vxd/vnbt.c +++ b/dlls/vnbt.vxd/vnbt.c @@ -114,8 +114,7 @@ BOOL WINAPI VNBT_DeviceIoControl(DWORD dwIoControlCode, * ipconfig.exe and winipcfg.exe read these from the * registry, there's no point */ } - if (fixedInfo) - HeapFree(GetProcessHeap(), 0, fixedInfo); + HeapFree(GetProcessHeap(), 0, fixedInfo); } size = 0; error = GetAdaptersInfo(NULL, &size); @@ -145,8 +144,7 @@ BOOL WINAPI VNBT_DeviceIoControl(DWORD dwIoControlCode, info->numEntries++; } } - if (adapterInfo) - HeapFree(GetProcessHeap(), 0, adapterInfo); + HeapFree(GetProcessHeap(), 0, adapterInfo); } } break; diff --git a/dlls/wined3d/indexbuffer.c b/dlls/wined3d/indexbuffer.c index 617cd18234a..df616880449 100644 --- a/dlls/wined3d/indexbuffer.c +++ b/dlls/wined3d/indexbuffer.c @@ -49,7 +49,7 @@ ULONG WINAPI IWineD3DIndexBufferImpl_Release(IWineD3DIndexBuffer *iface) { TRACE("(%p) : Releasing from %ld\n", This, This->resource.ref); ref = InterlockedDecrement(&This->resource.ref); if (ref == 0) { - if (NULL != This->allocatedMemory) HeapFree(GetProcessHeap(), 0, This->allocatedMemory); + HeapFree(GetProcessHeap(), 0, This->allocatedMemory); IWineD3DDevice_Release(This->resource.wineD3DDevice); HeapFree(GetProcessHeap(), 0, This); } else { diff --git a/dlls/wined3d/vertexbuffer.c b/dlls/wined3d/vertexbuffer.c index 21c894fd88b..c3d21c7f064 100644 --- a/dlls/wined3d/vertexbuffer.c +++ b/dlls/wined3d/vertexbuffer.c @@ -49,7 +49,7 @@ ULONG WINAPI IWineD3DVertexBufferImpl_Release(IWineD3DVertexBuffer *iface) { TRACE("(%p) : Releasing from %ld\n", This, This->resource.ref); ref = InterlockedDecrement(&This->resource.ref); if (ref == 0) { - if (NULL != This->allocatedMemory) HeapFree(GetProcessHeap(), 0, This->allocatedMemory); + HeapFree(GetProcessHeap(), 0, This->allocatedMemory); IWineD3DDevice_Release(This->resource.wineD3DDevice); HeapFree(GetProcessHeap(), 0, This); } else { diff --git a/dlls/winedos/vga.c b/dlls/winedos/vga.c index c9c115c920d..7ca39bdf2aa 100644 --- a/dlls/winedos/vga.c +++ b/dlls/winedos/vga.c @@ -496,8 +496,7 @@ int VGA_SetMode(unsigned Xres,unsigned Yres,unsigned Depth) newSize = 256 * 1024; if(vga_fb_size < newSize) { - if(vga_fb_data) - HeapFree(GetProcessHeap(), 0, vga_fb_data); + HeapFree(GetProcessHeap(), 0, vga_fb_data); vga_fb_data = HeapAlloc(GetProcessHeap(), 0, newSize); vga_fb_size = newSize; } diff --git a/dlls/wineps/clipping.c b/dlls/wineps/clipping.c index cc061dfb493..6919cdcf79d 100644 --- a/dlls/wineps/clipping.c +++ b/dlls/wineps/clipping.c @@ -115,7 +115,7 @@ void PSDRV_SetClip( PSDRV_PDEVICE *physDev ) } } end: - if(rgndata) HeapFree( GetProcessHeap(), 0, rgndata ); + HeapFree( GetProcessHeap(), 0, rgndata ); DeleteObject(hrgn); } diff --git a/dlls/wineps/escape.c b/dlls/wineps/escape.c index 999f67dab8e..902900081c7 100644 --- a/dlls/wineps/escape.c +++ b/dlls/wineps/escape.c @@ -416,9 +416,8 @@ INT PSDRV_EndDoc( PSDRV_PDEVICE *physDev ) ret = 0; } physDev->job.hJob = 0; - if(physDev->job.DocName) { - HeapFree(GetProcessHeap(), 0, physDev->job.DocName); - physDev->job.DocName = NULL; - } + HeapFree(GetProcessHeap(), 0, physDev->job.DocName); + physDev->job.DocName = NULL; + return ret; } diff --git a/dlls/wineps/init.c b/dlls/wineps/init.c index a3ecdce6e4a..200d7cc0afb 100644 --- a/dlls/wineps/init.c +++ b/dlls/wineps/init.c @@ -369,8 +369,7 @@ BOOL PSDRV_DeleteDC( PSDRV_PDEVICE *physDev ) TRACE("\n"); HeapFree( PSDRV_Heap, 0, physDev->Devmode ); - if(physDev->job.output) - HeapFree( PSDRV_Heap, 0, physDev->job.output ); + HeapFree( PSDRV_Heap, 0, physDev->job.output ); HeapFree( PSDRV_Heap, 0, physDev ); return TRUE; @@ -753,14 +752,10 @@ PRINTERINFO *PSDRV_FindPrinterInfo(LPCSTR name) closeprinter: ClosePrinter(hPrinter); cleanup: - if (ppdFileName) - HeapFree(PSDRV_Heap, 0, ppdFileName); - if (pi->FontSubTable) - HeapFree(PSDRV_Heap, 0, pi->FontSubTable); - if (pi->FriendlyName) - HeapFree(PSDRV_Heap, 0, pi->FriendlyName); - if (pi->Devmode) - HeapFree(PSDRV_Heap, 0, pi->Devmode); + HeapFree(PSDRV_Heap, 0, ppdFileName); + HeapFree(PSDRV_Heap, 0, pi->FontSubTable); + HeapFree(PSDRV_Heap, 0, pi->FriendlyName); + HeapFree(PSDRV_Heap, 0, pi->Devmode); fail: HeapFree(PSDRV_Heap, 0, pi); if (ppd) unlink(ppd); diff --git a/dlls/wineps/ppd.c b/dlls/wineps/ppd.c index 04991d33337..72a4f96596c 100644 --- a/dlls/wineps/ppd.c +++ b/dlls/wineps/ppd.c @@ -853,11 +853,11 @@ PPD *PSDRV_ParsePPD(char *fname) } } - if(tuple.key) HeapFree(PSDRV_Heap, 0, tuple.key); - if(tuple.option) HeapFree(PSDRV_Heap, 0, tuple.option); - if(tuple.value) HeapFree(PSDRV_Heap, 0, tuple.value); - if(tuple.opttrans) HeapFree(PSDRV_Heap, 0, tuple.opttrans); - if(tuple.valtrans) HeapFree(PSDRV_Heap, 0, tuple.valtrans); + HeapFree(PSDRV_Heap, 0, tuple.key); + HeapFree(PSDRV_Heap, 0, tuple.option); + HeapFree(PSDRV_Heap, 0, tuple.value); + HeapFree(PSDRV_Heap, 0, tuple.opttrans); + HeapFree(PSDRV_Heap, 0, tuple.valtrans); } diff --git a/dlls/wineps/type42.c b/dlls/wineps/type42.c index 97119c78bda..60a9b418be6 100644 --- a/dlls/wineps/type42.c +++ b/dlls/wineps/type42.c @@ -377,8 +377,8 @@ void T42_free(TYPE42 *t42) OTTable *table; for(table = t42->tables; table->MS_tag; table++) if(table->data) HeapFree(GetProcessHeap(), 0, table->data); - if(t42->glyph_sent) HeapFree(GetProcessHeap(), 0, t42->glyph_sent); - if(t42->glyf_blocks) HeapFree(GetProcessHeap(), 0, t42->glyf_blocks); + HeapFree(GetProcessHeap(), 0, t42->glyph_sent); + HeapFree(GetProcessHeap(), 0, t42->glyf_blocks); HeapFree(GetProcessHeap(), 0, t42); return; } diff --git a/dlls/wininet/cookie.c b/dlls/wininet/cookie.c index 70fcb1f4292..0ec115e092a 100644 --- a/dlls/wininet/cookie.c +++ b/dlls/wininet/cookie.c @@ -139,10 +139,8 @@ static cookie *COOKIE_findCookie(cookie_domain *domain, LPCWSTR lpszCookieName) /* removes a cookie from the list, if its the last cookie we also remove the domain */ static void COOKIE_deleteCookie(cookie *deadCookie, BOOL deleteDomain) { - if (deadCookie->lpCookieName) - HeapFree(GetProcessHeap(), 0, deadCookie->lpCookieName); - if (deadCookie->lpCookieData) - HeapFree(GetProcessHeap(), 0, deadCookie->lpCookieData); + HeapFree(GetProcessHeap(), 0, deadCookie->lpCookieName); + HeapFree(GetProcessHeap(), 0, deadCookie->lpCookieData); list_remove(&deadCookie->entry); /* special case: last cookie, lets remove the domain to save memory */ @@ -234,10 +232,8 @@ static void COOKIE_deleteDomain(cookie_domain *deadDomain) list_remove(cursor); } - if (deadDomain->lpCookieDomain) - HeapFree(GetProcessHeap(), 0, deadDomain->lpCookieDomain); - if (deadDomain->lpCookiePath) - HeapFree(GetProcessHeap(), 0, deadDomain->lpCookiePath); + HeapFree(GetProcessHeap(), 0, deadDomain->lpCookieDomain); + HeapFree(GetProcessHeap(), 0, deadDomain->lpCookiePath); list_remove(&deadDomain->entry); diff --git a/dlls/wininet/ftp.c b/dlls/wininet/ftp.c index 17544fefddf..1fbb5d5bfbe 100644 --- a/dlls/wininet/ftp.c +++ b/dlls/wininet/ftp.c @@ -2471,8 +2471,7 @@ BOOL FTP_SendData(LPWININETFTPSESSIONW lpwfs, INT nDataSocket, HANDLE hFile) TRACE("file transfer complete!\n"); - if(lpszBuffer != NULL) - HeapFree(GetProcessHeap(), 0, lpszBuffer); + HeapFree(GetProcessHeap(), 0, lpszBuffer); return nTotalSent; } @@ -2574,8 +2573,7 @@ BOOL FTP_RetrieveFileData(LPWININETFTPSESSIONW lpwfs, INT nDataSocket, DWORD nBy } TRACE("Data transfer complete\n"); - if (NULL != lpszBuffer) - HeapFree(GetProcessHeap(), 0, lpszBuffer); + HeapFree(GetProcessHeap(), 0, lpszBuffer); recv_end: return (nRC != -1); @@ -2607,12 +2605,8 @@ static void FTP_CloseSessionHandle(LPWININETHANDLEHEADER hdr) if (lpwfs->lstnSocket != -1) closesocket(lpwfs->lstnSocket); - if (lpwfs->lpszPassword) - HeapFree(GetProcessHeap(), 0, lpwfs->lpszPassword); - - if (lpwfs->lpszUserName) - HeapFree(GetProcessHeap(), 0, lpwfs->lpszUserName); - + HeapFree(GetProcessHeap(), 0, lpwfs->lpszPassword); + HeapFree(GetProcessHeap(), 0, lpwfs->lpszUserName); HeapFree(GetProcessHeap(), 0, lpwfs); } diff --git a/dlls/wininet/http.c b/dlls/wininet/http.c index 5b382cc2a89..915abf9ca8d 100644 --- a/dlls/wininet/http.c +++ b/dlls/wininet/http.c @@ -1306,8 +1306,7 @@ BOOL WINAPI HttpSendRequestA(HINTERNET hHttpRequest, LPCSTR lpszHeaders, MultiByteToWideChar(CP_ACP,0,lpszHeaders,dwHeaderLength,szHeaders,nLen); } result=HttpSendRequestW(hHttpRequest, szHeaders, nLen, lpOptional, dwOptionalLength); - if(szHeaders!=NULL) - HeapFree(GetProcessHeap(),0,szHeaders); + HeapFree(GetProcessHeap(),0,szHeaders); return result; } @@ -1372,11 +1371,9 @@ static BOOL HTTP_HandleRedirect(LPWININETHTTPREQW lpwhr, LPCWSTR lpszUrl, LPCWST HTTP_ADDHDR_FLAG_ADD_IF_NEW); #endif - if (NULL != lpwhs->lpszServerName) - HeapFree(GetProcessHeap(), 0, lpwhs->lpszServerName); + HeapFree(GetProcessHeap(), 0, lpwhs->lpszServerName); lpwhs->lpszServerName = WININET_strdupW(hostName); - if (NULL != lpwhs->lpszUserName) - HeapFree(GetProcessHeap(), 0, lpwhs->lpszUserName); + HeapFree(GetProcessHeap(), 0, lpwhs->lpszUserName); lpwhs->lpszUserName = WININET_strdupW(userName); lpwhs->nServerPort = urlComponents.nPort; @@ -1401,8 +1398,7 @@ static BOOL HTTP_HandleRedirect(LPWININETHTTPREQW lpwhr, LPCWSTR lpszUrl, LPCWST } - if(lpwhr->lpszPath) - HeapFree(GetProcessHeap(), 0, lpwhr->lpszPath); + HeapFree(GetProcessHeap(), 0, lpwhr->lpszPath); lpwhr->lpszPath=NULL; if (strlenW(path)) { @@ -2087,7 +2083,7 @@ BOOL HTTP_GetResponseHeaders(LPWININETHTTPREQW lpwhr) } }while(1); - if (lpwhr->lpszRawHeaders) HeapFree(GetProcessHeap(), 0, lpwhr->lpszRawHeaders); + HeapFree(GetProcessHeap(), 0, lpwhr->lpszRawHeaders); lpwhr->lpszRawHeaders = lpszRawHeaders; TRACE("raw headers: %s\n", debugstr_w(lpszRawHeaders)); bSuccess = TRUE; @@ -2288,8 +2284,7 @@ BOOL HTTP_ReplaceHeaderValue( LPHTTPHEADERW lphttpHdr, LPCWSTR value ) { INT len = 0; - if( lphttpHdr->lpszValue ) - HeapFree( GetProcessHeap(), 0, lphttpHdr->lpszValue ); + HeapFree( GetProcessHeap(), 0, lphttpHdr->lpszValue ); lphttpHdr->lpszValue = NULL; if( value ) @@ -2484,12 +2479,9 @@ static void HTTP_CloseHTTPRequestHandle(LPWININETHANDLEHEADER hdr) if (NETCON_connected(&lpwhr->netConnection)) HTTP_CloseConnection(lpwhr); - if (lpwhr->lpszPath) - HeapFree(GetProcessHeap(), 0, lpwhr->lpszPath); - if (lpwhr->lpszVerb) - HeapFree(GetProcessHeap(), 0, lpwhr->lpszVerb); - if (lpwhr->lpszRawHeaders) - HeapFree(GetProcessHeap(), 0, lpwhr->lpszRawHeaders); + HeapFree(GetProcessHeap(), 0, lpwhr->lpszPath); + HeapFree(GetProcessHeap(), 0, lpwhr->lpszVerb); + HeapFree(GetProcessHeap(), 0, lpwhr->lpszRawHeaders); for (i = 0; i <= HTTP_QUERY_MAX; i++) { @@ -2524,10 +2516,8 @@ void HTTP_CloseHTTPSessionHandle(LPWININETHANDLEHEADER hdr) TRACE("%p\n", lpwhs); - if (lpwhs->lpszServerName) - HeapFree(GetProcessHeap(), 0, lpwhs->lpszServerName); - if (lpwhs->lpszUserName) - HeapFree(GetProcessHeap(), 0, lpwhs->lpszUserName); + HeapFree(GetProcessHeap(), 0, lpwhs->lpszServerName); + HeapFree(GetProcessHeap(), 0, lpwhs->lpszUserName); HeapFree(GetProcessHeap(), 0, lpwhs); } diff --git a/dlls/wininet/internet.c b/dlls/wininet/internet.c index 61e377ee147..bc8ffdf7c8f 100644 --- a/dlls/wininet/internet.c +++ b/dlls/wininet/internet.c @@ -958,21 +958,11 @@ static VOID INTERNET_CloseHandle(LPWININETHANDLEHEADER hdr) TRACE("%p\n",lpwai); - if (lpwai->lpszAgent) - HeapFree(GetProcessHeap(), 0, lpwai->lpszAgent); - - if (lpwai->lpszProxy) - HeapFree(GetProcessHeap(), 0, lpwai->lpszProxy); - - if (lpwai->lpszProxyBypass) - HeapFree(GetProcessHeap(), 0, lpwai->lpszProxyBypass); - - if (lpwai->lpszProxyUsername) - HeapFree(GetProcessHeap(), 0, lpwai->lpszProxyUsername); - - if (lpwai->lpszProxyPassword) - HeapFree(GetProcessHeap(), 0, lpwai->lpszProxyPassword); - + HeapFree(GetProcessHeap(), 0, lpwai->lpszAgent); + HeapFree(GetProcessHeap(), 0, lpwai->lpszProxy); + HeapFree(GetProcessHeap(), 0, lpwai->lpszProxyBypass); + HeapFree(GetProcessHeap(), 0, lpwai->lpszProxyUsername); + HeapFree(GetProcessHeap(), 0, lpwai->lpszProxyPassword); HeapFree(GetProcessHeap(), 0, lpwai); } @@ -2609,8 +2599,7 @@ static VOID INTERNET_ExecuteWork(void) req = &workRequest.u.FtpFindFirstFileW; FTP_FtpFindFirstFileW(lpwfs, req->lpszSearchFile, req->lpFindFileData, req->dwFlags, req->dwContext); - if (req->lpszSearchFile != NULL) - HeapFree(GetProcessHeap(), 0, req->lpszSearchFile); + HeapFree(GetProcessHeap(), 0, req->lpszSearchFile); } break; diff --git a/dlls/winmm/driver.c b/dlls/winmm/driver.c index 29f33fab7f1..673f702b772 100644 --- a/dlls/winmm/driver.c +++ b/dlls/winmm/driver.c @@ -368,8 +368,8 @@ HDRVR WINAPI OpenDriverW(LPCWSTR lpDriverName, LPCWSTR lpSectionName, LPARAM lPa ret = OpenDriverA(dn, sn, lParam); - if (dn) HeapFree(GetProcessHeap(), 0, dn); - if (sn) HeapFree(GetProcessHeap(), 0, sn); + HeapFree(GetProcessHeap(), 0, dn); + HeapFree(GetProcessHeap(), 0, sn); return ret; } diff --git a/dlls/winmm/mci.c b/dlls/winmm/mci.c index 6fc6a3ab4b1..1db31aca353 100644 --- a/dlls/winmm/mci.c +++ b/dlls/winmm/mci.c @@ -415,10 +415,8 @@ static BOOL MCI_DeleteCommandTable(UINT uTbl) return FALSE; S_MciCmdTable[uTbl].lpTable = NULL; - if (S_MciCmdTable[uTbl].aVerbs) { - HeapFree(GetProcessHeap(), 0, S_MciCmdTable[uTbl].aVerbs); - S_MciCmdTable[uTbl].aVerbs = 0; - } + HeapFree(GetProcessHeap(), 0, S_MciCmdTable[uTbl].aVerbs); + S_MciCmdTable[uTbl].aVerbs = 0; return TRUE; } @@ -1090,7 +1088,7 @@ DWORD WINAPI mciSendStringW(LPCWSTR lpwstrCommand, LPWSTR lpwstrRet, if (lpwstrRet) MultiByteToWideChar( CP_ACP, 0, lpstrRet, -1, lpwstrRet, uRetLen ); HeapFree(GetProcessHeap(), 0, lpstrCommand); - if (lpstrRet) HeapFree(GetProcessHeap(), 0, lpstrRet); + HeapFree(GetProcessHeap(), 0, lpstrRet); return ret; } diff --git a/dlls/winmm/mciavi/mciavi.c b/dlls/winmm/mciavi/mciavi.c index 382b483b6ae..3f69fa50b08 100644 --- a/dlls/winmm/mciavi/mciavi.c +++ b/dlls/winmm/mciavi/mciavi.c @@ -237,29 +237,29 @@ static void MCIAVI_CleanUp(WINE_MCIAVI* wma) mmioClose(wma->hFile, 0); wma->hFile = 0; - if (wma->lpFileName) HeapFree(GetProcessHeap(), 0, wma->lpFileName); + HeapFree(GetProcessHeap(), 0, wma->lpFileName); wma->lpFileName = NULL; - if (wma->lpVideoIndex) HeapFree(GetProcessHeap(), 0, wma->lpVideoIndex); + HeapFree(GetProcessHeap(), 0, wma->lpVideoIndex); wma->lpVideoIndex = NULL; - if (wma->lpAudioIndex) HeapFree(GetProcessHeap(), 0, wma->lpAudioIndex); + HeapFree(GetProcessHeap(), 0, wma->lpAudioIndex); wma->lpAudioIndex = NULL; if (wma->hic) ICClose(wma->hic); wma->hic = 0; - if (wma->inbih) HeapFree(GetProcessHeap(), 0, wma->inbih); + HeapFree(GetProcessHeap(), 0, wma->inbih); wma->inbih = NULL; - if (wma->outbih) HeapFree(GetProcessHeap(), 0, wma->outbih); + HeapFree(GetProcessHeap(), 0, wma->outbih); wma->outbih = NULL; - if (wma->indata) HeapFree(GetProcessHeap(), 0, wma->indata); + HeapFree(GetProcessHeap(), 0, wma->indata); wma->indata = NULL; - if (wma->outdata) HeapFree(GetProcessHeap(), 0, wma->outdata); + HeapFree(GetProcessHeap(), 0, wma->outdata); wma->outdata = NULL; if (wma->hbmFrame) DeleteObject(wma->hbmFrame); wma->hbmFrame = 0; if (wma->hWnd) DestroyWindow(wma->hWnd); wma->hWnd = 0; - if (wma->lpWaveFormat) HeapFree(GetProcessHeap(), 0, wma->lpWaveFormat); + HeapFree(GetProcessHeap(), 0, wma->lpWaveFormat); wma->lpWaveFormat = 0; memset(&wma->mah, 0, sizeof(wma->mah)); diff --git a/dlls/winmm/mciwave/mciwave.c b/dlls/winmm/mciwave/mciwave.c index e00baad7853..4fab14c59d4 100644 --- a/dlls/winmm/mciwave/mciwave.c +++ b/dlls/winmm/mciwave/mciwave.c @@ -336,8 +336,7 @@ static DWORD WAVE_mciCreateRIFFSkeleton(WINE_MCIWAVE* wmw) return 0; err: - if (wmw->lpWaveFormat) - HeapFree(GetProcessHeap(), 0, wmw->lpWaveFormat); + HeapFree(GetProcessHeap(), 0, wmw->lpWaveFormat); wmw->lpWaveFormat = NULL; return MCIERR_INVALID_FILE; } diff --git a/dlls/winmm/playsound.c b/dlls/winmm/playsound.c index a18c4bafeab..3a7ec559573 100644 --- a/dlls/winmm/playsound.c +++ b/dlls/winmm/playsound.c @@ -410,8 +410,8 @@ static DWORD WINAPI proc_PlaySound(LPVOID arg) errCleanUp: TRACE("Done playing='%s' => %s!\n", debugstr_w(wps->pszSound), bRet ? "ok" : "ko"); CloseHandle(s.hEvent); - if (waveHdr) HeapFree(GetProcessHeap(), 0, waveHdr); - if (lpWaveFormat) HeapFree(GetProcessHeap(), 0, lpWaveFormat); + HeapFree(GetProcessHeap(), 0, waveHdr); + HeapFree(GetProcessHeap(), 0, lpWaveFormat); if (hWave) while (waveOutClose(hWave) == WAVERR_STILLPLAYING) Sleep(100); if (hmmio) mmioClose(hmmio, 0); diff --git a/dlls/winmm/winealsa/midi.c b/dlls/winmm/winealsa/midi.c index 5dd4d99b98b..d11ffa49764 100644 --- a/dlls/winmm/winealsa/midi.c +++ b/dlls/winmm/winealsa/midi.c @@ -779,10 +779,8 @@ static DWORD modClose(WORD wDevID) return MMSYSERR_NOTENABLED; } - if (MidiOutDev[wDevID].lpExtra != 0) { - HeapFree(GetProcessHeap(), 0, MidiOutDev[wDevID].lpExtra); - MidiOutDev[wDevID].lpExtra = 0; - } + HeapFree(GetProcessHeap(), 0, MidiOutDev[wDevID].lpExtra); + MidiOutDev[wDevID].lpExtra = 0; MidiOutDev[wDevID].bufsize = 0; if (MIDI_NotifyClient(wDevID, MOM_CLOSE, 0L, 0L) != MMSYSERR_NOERROR) { diff --git a/dlls/winmm/winearts/audio.c b/dlls/winmm/winearts/audio.c index 35d1838fb47..25630c5218a 100644 --- a/dlls/winmm/winearts/audio.c +++ b/dlls/winmm/winearts/audio.c @@ -336,12 +336,8 @@ static void ARTS_CloseWaveOutDevice(WINE_WAVEOUT* wwo) wwo->play_stream = (arts_stream_t*)-1; /* free up the buffer we use for volume and reset the size */ - if(wwo->sound_buffer) - { - HeapFree(GetProcessHeap(), 0, wwo->sound_buffer); - wwo->sound_buffer = NULL; - } - + HeapFree(GetProcessHeap(), 0, wwo->sound_buffer); + wwo->sound_buffer = NULL; wwo->buffer_size = 0; } diff --git a/dlls/winmm/wineoss/dscapture.c b/dlls/winmm/wineoss/dscapture.c index 11c119b5410..d35b3aa6401 100644 --- a/dlls/winmm/wineoss/dscapture.c +++ b/dlls/winmm/wineoss/dscapture.c @@ -459,8 +459,7 @@ static ULONG WINAPI IDsCaptureDriverBufferImpl_Release(PIDSCDRIVERBUFFER iface) wwi->dwFragmentSize = 0; This->drv->capture_buffer = NULL; - if (This->notifies != NULL) - HeapFree(GetProcessHeap(), 0, This->notifies); + HeapFree(GetProcessHeap(), 0, This->notifies); HeapFree(GetProcessHeap(),0,This); TRACE("(%p) released\n",This); } diff --git a/dlls/winmm/wineoss/dsrender.c b/dlls/winmm/wineoss/dsrender.c index a6a13d36ee9..35354f51ebb 100644 --- a/dlls/winmm/wineoss/dsrender.c +++ b/dlls/winmm/wineoss/dsrender.c @@ -275,8 +275,7 @@ static ULONG WINAPI IDsDriverNotifyImpl_Release(PIDSDRIVERNOTIFY iface) ref = InterlockedDecrement(&(This->ref)); if (ref == 0) { IDsDriverBuffer_Release((PIDSDRIVERBUFFER)This->buffer); - if (This->notifies != NULL) - HeapFree(GetProcessHeap(), 0, This->notifies); + HeapFree(GetProcessHeap(), 0, This->notifies); HeapFree(GetProcessHeap(),0,This); TRACE("(%p) released\n",This); } diff --git a/dlls/winmm/wineoss/midi.c b/dlls/winmm/wineoss/midi.c index 02815aedd07..36b36171e5c 100644 --- a/dlls/winmm/wineoss/midi.c +++ b/dlls/winmm/wineoss/midi.c @@ -1182,10 +1182,8 @@ static DWORD modClose(WORD wDevID) return MMSYSERR_NOTENABLED; } - if (MidiOutDev[wDevID].lpExtra != 0) { - HeapFree(GetProcessHeap(), 0, MidiOutDev[wDevID].lpExtra); - MidiOutDev[wDevID].lpExtra = 0; - } + HeapFree(GetProcessHeap(), 0, MidiOutDev[wDevID].lpExtra); + MidiOutDev[wDevID].lpExtra = 0; MidiOutDev[wDevID].bufsize = 0; if (MIDI_NotifyClient(wDevID, MOM_CLOSE, 0L, 0L) != MMSYSERR_NOERROR) { diff --git a/dlls/winsock/socket.c b/dlls/winsock/socket.c index 0538b70ba36..b3095cc0f97 100644 --- a/dlls/winsock/socket.c +++ b/dlls/winsock/socket.c @@ -936,9 +936,7 @@ static void ws2_async_cleanup ( struct async_private *ap ) HeapFree ( GetProcessHeap(), 0, as->async.iosb ); } - if ( as->iovec ) - HeapFree ( GetProcessHeap(), 0, as->iovec ); - + HeapFree ( GetProcessHeap(), 0, as->iovec ); HeapFree ( GetProcessHeap(), 0, as ); } @@ -2809,7 +2807,7 @@ struct WS_servent* WINAPI WS_getservbyname(const char *name, const char *proto) } else SetLastError(WSANO_DATA); LeaveCriticalSection( &csWSgetXXXbyYYY ); - if (proto_str) HeapFree( GetProcessHeap(), 0, proto_str ); + HeapFree( GetProcessHeap(), 0, proto_str ); HeapFree( GetProcessHeap(), 0, name_str ); TRACE( "%s, %s ret %p\n", debugstr_a(name), debugstr_a(proto), retval ); return retval; @@ -2836,7 +2834,7 @@ struct WS_servent* WINAPI WS_getservbyport(int port, const char *proto) } else SetLastError(WSANO_DATA); LeaveCriticalSection( &csWSgetXXXbyYYY ); - if (proto_str) HeapFree( GetProcessHeap(), 0, proto_str ); + HeapFree( GetProcessHeap(), 0, proto_str ); #endif TRACE("%d (i.e. port %d), %s ret %p\n", port, (int)ntohl(port), debugstr_a(proto), retval); return retval; diff --git a/dlls/winsock/socket16.c b/dlls/winsock/socket16.c index 1f0826430e9..bc1b3fba2a6 100644 --- a/dlls/winsock/socket16.c +++ b/dlls/winsock/socket16.c @@ -566,9 +566,9 @@ INT WINAPI WSACleanup16(void) se_buffer_seg = 0; pe_buffer_seg = 0; dbuffer_seg = 0; - if (he_buffer) HeapFree( GetProcessHeap(), 0, he_buffer ); - if (se_buffer) HeapFree( GetProcessHeap(), 0, se_buffer ); - if (pe_buffer) HeapFree( GetProcessHeap(), 0, pe_buffer ); + HeapFree( GetProcessHeap(), 0, he_buffer ); + HeapFree( GetProcessHeap(), 0, se_buffer ); + HeapFree( GetProcessHeap(), 0, pe_buffer ); he_buffer = NULL; se_buffer = NULL; pe_buffer = NULL; diff --git a/dlls/winspool/info.c b/dlls/winspool/info.c index 155c60fc097..7db3776023a 100644 --- a/dlls/winspool/info.c +++ b/dlls/winspool/info.c @@ -2703,8 +2703,7 @@ BOOL WINAPI GetPrinterDriverDirectoryA(LPSTR pName, LPSTR pEnvironment, TRACE("provided<%ld> required <%ld>\n", cbBuf, *pcbNeeded); - if(driverDirectoryW) - HeapFree( GetProcessHeap(), 0, driverDirectoryW ); + HeapFree( GetProcessHeap(), 0, driverDirectoryW ); RtlFreeUnicodeString(&environmentW); RtlFreeUnicodeString(&nameW); @@ -3203,7 +3202,7 @@ BOOL WINAPI GetDefaultPrinterW(LPWSTR name, LPDWORD namesize) strcpyW(name, buffer); end: - if(buffer) HeapFree( GetProcessHeap(), 0, buffer); + HeapFree( GetProcessHeap(), 0, buffer); return retval; } @@ -3243,7 +3242,7 @@ BOOL WINAPI GetDefaultPrinterA(LPSTR name, LPDWORD namesize) TRACE("0x%08lx/0x%08lx:%s\n", *namesize, insize, debugstr_w(bufferW)); end: - if(bufferW) HeapFree( GetProcessHeap(), 0, bufferW); + HeapFree( GetProcessHeap(), 0, bufferW); return retval; } diff --git a/dlls/x11drv/dib.c b/dlls/x11drv/dib.c index f41372f0944..a510bf7b0d1 100644 --- a/dlls/x11drv/dib.c +++ b/dlls/x11drv/dib.c @@ -3896,7 +3896,7 @@ INT X11DRV_SetDIBits( X11DRV_PDEVICE *physDev, HBITMAP hbitmap, UINT startscan, result = X11DRV_DIB_SetImageBits( &descr ); X11DRV_DIB_Unlock(bmp, TRUE); - if (descr.colorMap) HeapFree(GetProcessHeap(), 0, descr.colorMap); + HeapFree(GetProcessHeap(), 0, descr.colorMap); GDI_ReleaseObj( hbitmap ); return result; @@ -4853,9 +4853,9 @@ HBITMAP X11DRV_DIB_CreateDIBSection( } if (dib && dib->image) { XDestroyImage(dib->image); dib->image = NULL; } - if (colorMap) { HeapFree(GetProcessHeap(), 0, colorMap); colorMap = NULL; } - if (colorTable) { HeapFree(GetProcessHeap(), 0, colorTable); colorTable = NULL; } - if (dib) { HeapFree(GetProcessHeap(), 0, dib); dib = NULL; } + HeapFree(GetProcessHeap(), 0, colorMap); colorMap = NULL; + HeapFree(GetProcessHeap(), 0, colorTable); colorTable = NULL; + HeapFree(GetProcessHeap(), 0, dib); dib = NULL; if (bmp) { GDI_ReleaseObj(res); bmp = NULL; } if (res) { DeleteObject(res); res = 0; } } @@ -4901,10 +4901,8 @@ void X11DRV_DIB_DeleteDIBSection(BITMAPOBJ *bmp) wine_tsx11_unlock(); } - if (dib->colorMap) - HeapFree(GetProcessHeap(), 0, dib->colorMap); - if (dib->colorTable) - HeapFree(GetProcessHeap(), 0, dib->colorTable); + HeapFree(GetProcessHeap(), 0, dib->colorMap); + HeapFree(GetProcessHeap(), 0, dib->colorTable); DeleteCriticalSection(&(dib->lock)); } diff --git a/dlls/x11drv/palette.c b/dlls/x11drv/palette.c index 50e14d5cf22..5658a00cc5e 100644 --- a/dlls/x11drv/palette.c +++ b/dlls/x11drv/palette.c @@ -640,7 +640,7 @@ static BOOL X11DRV_PALETTE_BuildSharedMap( const PALETTEENTRY *sys_pal_template X11DRV_PALETTE_XPixelToPalette[X11DRV_PALETTE_PaletteToXPixel[i]] = i; } - if( pixDynMapping ) HeapFree(GetProcessHeap(), 0, pixDynMapping); + HeapFree(GetProcessHeap(), 0, pixDynMapping); return TRUE; } diff --git a/dlls/x11drv/text.c b/dlls/x11drv/text.c index 2c677b26c4d..bcb37e8c65e 100644 --- a/dlls/x11drv/text.c +++ b/dlls/x11drv/text.c @@ -427,7 +427,7 @@ X11DRV_ExtTextOut( X11DRV_PDEVICE *physDev, INT x, INT y, UINT flags, goto END; FAIL: - if(str2b != NULL) HeapFree( GetProcessHeap(), 0, str2b ); + HeapFree( GetProcessHeap(), 0, str2b ); result = FALSE; END: diff --git a/dlls/x11drv/xfont.c b/dlls/x11drv/xfont.c index edc2ac713f0..1418937ebc7 100644 --- a/dlls/x11drv/xfont.c +++ b/dlls/x11drv/xfont.c @@ -2141,7 +2141,7 @@ static int XFONT_BuildMetrics(char** x_pattern, int res, unsigned x_checksum, in nextfont: HeapFree(GetProcessHeap(), 0, typeface); } - if( fi ) HeapFree(GetProcessHeap(), 0, fi); + HeapFree(GetProcessHeap(), 0, fi); /* Scan through the font list and remove FontResource(s) (fr) * that have no associated Fontinfo(s) (fi). @@ -2301,7 +2301,7 @@ static BOOL XFONT_ReadCachedMetrics( int fd, int res, unsigned x_checksum, int x u,x_checksum,i,x_count); } fail: - if( fontList ) HeapFree( GetProcessHeap(), 0, fontList ); + HeapFree( GetProcessHeap(), 0, fontList ); fontList = NULL; close( fd ); } @@ -2821,8 +2821,7 @@ static fontObject* XFONT_GetCacheEntry(void) else fontMRU = (INT16)fontCache[j].lru; /* FIXME: lpXForm, lpPixmap */ - if(fontCache[j].lpX11Trans) - HeapFree( GetProcessHeap(), 0, fontCache[j].lpX11Trans ); + HeapFree( GetProcessHeap(), 0, fontCache[j].lpX11Trans ); wine_tsx11_lock(); XFreeFont( gdi_display, fontCache[j].fs ); diff --git a/dlls/x11drv/xrandr.c b/dlls/x11drv/xrandr.c index d2d37c196fa..64775c7f80b 100644 --- a/dlls/x11drv/xrandr.c +++ b/dlls/x11drv/xrandr.c @@ -306,16 +306,10 @@ void X11DRV_XRandR_Init(void) void X11DRV_XRandR_Cleanup(void) { - if (real_xrandr_rates) - { - HeapFree(GetProcessHeap(), 0, real_xrandr_rates); - real_xrandr_rates = NULL; - } - if (real_xrandr_rates_count) - { - HeapFree(GetProcessHeap(), 0, real_xrandr_rates_count); - real_xrandr_rates_count = NULL; - } + HeapFree(GetProcessHeap(), 0, real_xrandr_rates); + real_xrandr_rates = NULL; + HeapFree(GetProcessHeap(), 0, real_xrandr_rates_count); + real_xrandr_rates_count = NULL; } #endif /* HAVE_LIBXRANDR */ diff --git a/dlls/x11drv/xrender.c b/dlls/x11drv/xrender.c index 89bb1d8f7c1..07f71242729 100644 --- a/dlls/x11drv/xrender.c +++ b/dlls/x11drv/xrender.c @@ -1524,8 +1524,7 @@ BOOL X11DRV_XRender_ExtTextOut( X11DRV_PDEVICE *physDev, INT x, INT y, UINT flag physDev->org.y + y - width * sinEsc - strikeoutPos * cosEsc); } wine_tsx11_unlock(); - if(otm) - HeapFree(GetProcessHeap(), 0, otm); + HeapFree(GetProcessHeap(), 0, otm); } if(deltas && deltas != lpDx) diff --git a/programs/regedit/regproc.c b/programs/regedit/regproc.c index b75cb0d770e..9d9f19d698b 100644 --- a/programs/regedit/regproc.c +++ b/programs/regedit/regproc.c @@ -435,8 +435,7 @@ HRESULT setValue(LPSTR val_name, LPSTR val_data) lpbData, dwLen); - if (bBigBuffer) - HeapFree (GetProcessHeap(), 0, bBigBuffer); + HeapFree (GetProcessHeap(), 0, bBigBuffer); return hRes; } diff --git a/programs/rundll32/rundll32.c b/programs/rundll32/rundll32.c index 0b77979e6be..4a11d48dfa1 100644 --- a/programs/rundll32/rundll32.c +++ b/programs/rundll32/rundll32.c @@ -319,7 +319,6 @@ CLEANUP: DestroyWindow(hWnd); if (hDll) FreeLibrary(hDll); - if (szDllName) - HeapFree(GetProcessHeap(),0,szDllName); + HeapFree(GetProcessHeap(),0,szDllName); return 0; /* rundll32 always returns 0! */ } diff --git a/programs/winecfg/appdefaults.c b/programs/winecfg/appdefaults.c index 4a3666598d1..c07ab8f8508 100644 --- a/programs/winecfg/appdefaults.c +++ b/programs/winecfg/appdefaults.c @@ -276,7 +276,7 @@ static void on_add_app_click(HWND dialog) HWND listview = GetDlgItem(dialog, IDC_APP_LISTVIEW); int count = ListView_GetItemCount(listview); - if (current_app) HeapFree(GetProcessHeap(), 0, current_app); + HeapFree(GetProcessHeap(), 0, current_app); current_app = strdupA(filetitle); WINE_TRACE("adding %s\n", current_app); diff --git a/programs/winecfg/driveui.c b/programs/winecfg/driveui.c index 0b99f31a087..6422b8f8398 100644 --- a/programs/winecfg/driveui.c +++ b/programs/winecfg/driveui.c @@ -432,7 +432,7 @@ void on_edit_changed(HWND dialog, WORD id) char *label; label = get_text(dialog, id); - if (current_drive->label) HeapFree(GetProcessHeap(), 0, current_drive->label); + HeapFree(GetProcessHeap(), 0, current_drive->label); current_drive->label = label ? label : strdupA(""); WINE_TRACE("set label to %s\n", current_drive->label); @@ -446,7 +446,7 @@ void on_edit_changed(HWND dialog, WORD id) char *path; path = get_text(dialog, id); - if (current_drive->unixpath) HeapFree(GetProcessHeap(), 0, current_drive->unixpath); + HeapFree(GetProcessHeap(), 0, current_drive->unixpath); current_drive->unixpath = path ? path : strdupA("drive_c"); WINE_TRACE("set path to %s\n", current_drive->unixpath); @@ -460,7 +460,7 @@ void on_edit_changed(HWND dialog, WORD id) char *serial; serial = get_text(dialog, id); - if (current_drive->serial) HeapFree(GetProcessHeap(), 0, current_drive->serial); + HeapFree(GetProcessHeap(), 0, current_drive->serial); current_drive->serial = serial ? serial : strdupA(""); WINE_TRACE("set serial to %s", current_drive->serial); @@ -472,7 +472,7 @@ void on_edit_changed(HWND dialog, WORD id) { char *device = get_text(dialog, id); /* TODO: handle device if/when it makes sense to do so.... */ - if (device) HeapFree(GetProcessHeap(), 0, device); + HeapFree(GetProcessHeap(), 0, device); fill_drives_list(dialog); break; } @@ -588,11 +588,11 @@ DriveDlgProc (HWND dialog, UINT msg, WPARAM wParam, LPARAM lParam) char *str; str = get_text(dialog, IDC_EDIT_LABEL); - if (current_drive->label) HeapFree(GetProcessHeap(), 0, current_drive->label); + HeapFree(GetProcessHeap(), 0, current_drive->label); current_drive->label = str ? str : strdupA(""); str = get_text(dialog, IDC_EDIT_SERIAL); - if (current_drive->serial) HeapFree(GetProcessHeap(), 0, current_drive->serial); + HeapFree(GetProcessHeap(), 0, current_drive->serial); current_drive->serial = str ? str : strdupA(""); /* TODO: we don't have a device at this point */ diff --git a/programs/winecfg/winecfg.c b/programs/winecfg/winecfg.c index f9e630d9178..a97d5279de1 100644 --- a/programs/winecfg/winecfg.c +++ b/programs/winecfg/winecfg.c @@ -222,7 +222,7 @@ static void free_setting(struct setting *setting) HeapFree(GetProcessHeap(), 0, setting->path); HeapFree(GetProcessHeap(), 0, setting->name); - if (setting->value) HeapFree(GetProcessHeap(), 0, setting->value); + HeapFree(GetProcessHeap(), 0, setting->value); list_remove(&setting->entry); @@ -298,7 +298,7 @@ void set(char *path, char *name, char *value) if (strcasecmp(s->name, name) != 0) continue; /* yes, we have already set it, so just replace the content and return */ - if (s->value) HeapFree(GetProcessHeap(), 0, s->value); + HeapFree(GetProcessHeap(), 0, s->value); s->value = value ? strdupA(value) : NULL; return; @@ -478,7 +478,7 @@ char *keypath(char *section) { static char *result = NULL; - if (result) HeapFree(GetProcessHeap(), 0, result); + HeapFree(GetProcessHeap(), 0, result); if (current_app) { diff --git a/programs/wineconsole/dialog.c b/programs/wineconsole/dialog.c index ef60b869a57..fc54d101fb2 100644 --- a/programs/wineconsole/dialog.c +++ b/programs/wineconsole/dialog.c @@ -461,7 +461,7 @@ static BOOL fill_list_size(struct dialog_info* di, BOOL doInit) SendDlgItemMessage(di->hDlg, IDC_FNT_LIST_FONT, LB_GETTEXT, idx, (LPARAM)lfFaceName); SendDlgItemMessage(di->hDlg, IDC_FNT_LIST_SIZE, LB_RESETCONTENT, 0L, 0L); - if (di->font) HeapFree(GetProcessHeap(), 0, di->font); + HeapFree(GetProcessHeap(), 0, di->font); di->nFont = 0; di->font = NULL; diff --git a/programs/wineconsole/wineconsole.c b/programs/wineconsole/wineconsole.c index abb0ed01b82..a54e9ed1528 100644 --- a/programs/wineconsole/wineconsole.c +++ b/programs/wineconsole/wineconsole.c @@ -519,7 +519,7 @@ static void WINECON_Delete(struct inner_data* data) if (data->hConIn) CloseHandle(data->hConIn); if (data->hConOut) CloseHandle(data->hConOut); if (data->hSynchro) CloseHandle(data->hSynchro); - if (data->cells) HeapFree(GetProcessHeap(), 0, data->cells); + HeapFree(GetProcessHeap(), 0, data->cells); HeapFree(GetProcessHeap(), 0, data); } diff --git a/programs/winedbg/stack.c b/programs/winedbg/stack.c index b743d3b5106..1893007f34c 100644 --- a/programs/winedbg/stack.c +++ b/programs/winedbg/stack.c @@ -153,7 +153,7 @@ void stack_backtrace(DWORD tid, BOOL noisy) if (tid == dbg_curr_tid) { thread = dbg_curr_thread; - if (frames) HeapFree(GetProcessHeap(), 0, frames); + HeapFree(GetProcessHeap(), 0, frames); frames = NULL; } else diff --git a/programs/winemenubuilder/winemenubuilder.c b/programs/winemenubuilder/winemenubuilder.c index 2447a722251..72df053bec6 100644 --- a/programs/winemenubuilder/winemenubuilder.c +++ b/programs/winemenubuilder/winemenubuilder.c @@ -476,8 +476,7 @@ static char *extract_icon( const char *path, int index) } if (iconsdir==NULL || *iconsdir=='\0') { - if (iconsdir) - HeapFree(GetProcessHeap(), 0, iconsdir); + HeapFree(GetProcessHeap(), 0, iconsdir); return NULL; /* No icon created */ } @@ -814,10 +813,8 @@ static BOOL InvokeShellLinker( IShellLinkA *sl, LPCWSTR link ) HeapFree( GetProcessHeap(), 0, icon_name ); HeapFree( GetProcessHeap(), 0, work_dir ); HeapFree( GetProcessHeap(), 0, link_name ); - if (escaped_args) - HeapFree( GetProcessHeap(), 0, escaped_args ); - if (escaped_path) - HeapFree( GetProcessHeap(), 0, escaped_path ); + HeapFree( GetProcessHeap(), 0, escaped_args ); + HeapFree( GetProcessHeap(), 0, escaped_path ); if (r) { diff --git a/programs/winhelp/hlpfile.c b/programs/winhelp/hlpfile.c index d56e2c680f2..3a969620557 100644 --- a/programs/winhelp/hlpfile.c +++ b/programs/winhelp/hlpfile.c @@ -268,10 +268,10 @@ HLPFILE *HLPFILE_ReadHlpFile(LPCSTR lpszPath) hlpfile = 0; } - if (phrases.offsets) HeapFree(GetProcessHeap(), 0, phrases.offsets); - if (phrases.buffer) HeapFree(GetProcessHeap(), 0, phrases.buffer); - if (topic.map) HeapFree(GetProcessHeap(), 0, topic.map); - if (file_buffer) HeapFree(GetProcessHeap(), 0, file_buffer); + HeapFree(GetProcessHeap(), 0, phrases.offsets); + HeapFree(GetProcessHeap(), 0, phrases.buffer); + HeapFree(GetProcessHeap(), 0, topic.map); + HeapFree(GetProcessHeap(), 0, file_buffer); return hlpfile; } @@ -1992,8 +1992,8 @@ void HLPFILE_FreeHlpFile(HLPFILE* hlpfile) HLPFILE_DeleteMacro(hlpfile->first_macro); if (hlpfile->numWindows) HeapFree(GetProcessHeap(), 0, hlpfile->windows); - if (hlpfile->Context) HeapFree(GetProcessHeap(), 0, hlpfile->Context); - if (hlpfile->lpszTitle) HeapFree(GetProcessHeap(), 0, hlpfile->lpszTitle); - if (hlpfile->lpszCopyright) HeapFree(GetProcessHeap(), 0, hlpfile->lpszCopyright); + HeapFree(GetProcessHeap(), 0, hlpfile->Context); + HeapFree(GetProcessHeap(), 0, hlpfile->lpszTitle); + HeapFree(GetProcessHeap(), 0, hlpfile->lpszCopyright); HeapFree(GetProcessHeap(), 0, hlpfile); } diff --git a/programs/winhelp/macro.lex.l b/programs/winhelp/macro.lex.l index a20caa32032..0b85245fe0d 100644 --- a/programs/winhelp/macro.lex.l +++ b/programs/winhelp/macro.lex.l @@ -277,11 +277,8 @@ BOOL MACRO_ExecuteMacro(LPCSTR macro) } } - if (strptr) - { - HeapFree(GetProcessHeap(), 0, strptr); - strptr = NULL; - } + HeapFree(GetProcessHeap(), 0, strptr); + strptr = NULL; quote_stk_idx = 0; return 1; diff --git a/windows/cursoricon.c b/windows/cursoricon.c index 9f94307237c..94e22063d17 100644 --- a/windows/cursoricon.c +++ b/windows/cursoricon.c @@ -642,8 +642,8 @@ static BOOL CURSORICON_SimulateLoadingFromResourceW( LPCWSTR filename, BOOL fCur UnmapViewOfFile( bits ); return TRUE; fail: - if (*res) HeapFree( GetProcessHeap(), 0, *res ); - if (*ptr) HeapFree( GetProcessHeap(), 0, *ptr ); + HeapFree( GetProcessHeap(), 0, *res ); + HeapFree( GetProcessHeap(), 0, *ptr ); UnmapViewOfFile( bits ); return FALSE; } diff --git a/windows/defwnd.c b/windows/defwnd.c index 9ffc5ba2b5c..4fa1d6f9b5f 100644 --- a/windows/defwnd.c +++ b/windows/defwnd.c @@ -96,7 +96,7 @@ static void DEFWND_SetTextA( HWND hwnd, LPCSTR text ) if (!(wndPtr = WIN_GetPtr( hwnd ))) return; if ((textW = HeapAlloc(GetProcessHeap(), 0, count * sizeof(WCHAR)))) { - if (wndPtr->text) HeapFree(GetProcessHeap(), 0, wndPtr->text); + HeapFree(GetProcessHeap(), 0, wndPtr->text); wndPtr->text = textW; MultiByteToWideChar( CP_ACP, 0, text, -1, textW, count ); SERVER_START_REQ( set_window_text ) @@ -129,7 +129,7 @@ static void DEFWND_SetTextW( HWND hwnd, LPCWSTR text ) count = strlenW(text) + 1; if (!(wndPtr = WIN_GetPtr( hwnd ))) return; - if (wndPtr->text) HeapFree(GetProcessHeap(), 0, wndPtr->text); + HeapFree(GetProcessHeap(), 0, wndPtr->text); if ((wndPtr->text = HeapAlloc(GetProcessHeap(), 0, count * sizeof(WCHAR)))) { strcpyW( wndPtr->text, text ); @@ -408,10 +408,10 @@ static LRESULT DEFWND_DefWinProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPa { WND *wndPtr = WIN_GetPtr( hwnd ); if (!wndPtr) return 0; - if (wndPtr->text) HeapFree( GetProcessHeap(), 0, wndPtr->text ); + HeapFree( GetProcessHeap(), 0, wndPtr->text ); wndPtr->text = NULL; - if (wndPtr->pVScroll) HeapFree( GetProcessHeap(), 0, wndPtr->pVScroll ); - if (wndPtr->pHScroll) HeapFree( GetProcessHeap(), 0, wndPtr->pHScroll ); + HeapFree( GetProcessHeap(), 0, wndPtr->pVScroll ); + HeapFree( GetProcessHeap(), 0, wndPtr->pHScroll ); wndPtr->pVScroll = wndPtr->pHScroll = NULL; WIN_ReleasePtr( wndPtr ); return 0; diff --git a/windows/mdi.c b/windows/mdi.c index def0eacf866..8f140e0a857 100644 --- a/windows/mdi.c +++ b/windows/mdi.c @@ -949,7 +949,7 @@ static void MDI_UpdateFrameText( HWND frame, HWND hClient, LPCWSTR lpTitle ) /* store new "default" title if lpTitle is not NULL */ if (lpTitle) { - if (ci->frameTitle) HeapFree( GetProcessHeap(), 0, ci->frameTitle ); + HeapFree( GetProcessHeap(), 0, ci->frameTitle ); if ((ci->frameTitle = HeapAlloc( GetProcessHeap(), 0, (strlenW(lpTitle)+1)*sizeof(WCHAR)))) strcpyW( ci->frameTitle, lpTitle ); } @@ -1053,8 +1053,8 @@ static LRESULT MDIClientWndProc_common( HWND hwnd, UINT message, ci->nActiveChildren = 0; MDI_RefreshMenu(ci); - if (ci->child) HeapFree( GetProcessHeap(), 0, ci->child ); - if (ci->frameTitle) HeapFree( GetProcessHeap(), 0, ci->frameTitle ); + HeapFree( GetProcessHeap(), 0, ci->child ); + HeapFree( GetProcessHeap(), 0, ci->frameTitle ); return 0; } diff --git a/windows/win.c b/windows/win.c index 91dd168a905..a89c9474207 100644 --- a/windows/win.c +++ b/windows/win.c @@ -149,7 +149,7 @@ static WND *free_window_handle( HWND hwnd ) SERVER_END_REQ; } USER_Unlock(); - if (ptr) HeapFree( GetProcessHeap(), 0, ptr ); + HeapFree( GetProcessHeap(), 0, ptr ); return ptr; } @@ -1580,8 +1580,8 @@ static HWND WIN_FindWindow( HWND parent, HWND child, ATOM className, LPCWSTR tit retvalue = list[i]; done: - if (list) HeapFree( GetProcessHeap(), 0, list ); - if (buffer) HeapFree( GetProcessHeap(), 0, buffer ); + HeapFree( GetProcessHeap(), 0, list ); + HeapFree( GetProcessHeap(), 0, buffer ); return retvalue; } diff --git a/windows/winproc.c b/windows/winproc.c index 3859002e21b..8c55e74d1a7 100644 --- a/windows/winproc.c +++ b/windows/winproc.c @@ -889,8 +889,8 @@ LRESULT WINPROC_UnmapMsg32ATo32W( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPa LPWSTR lpszClass; /* allocated Class */ }; struct s *xs = (struct s *)lParam; - if (xs->lpszName) HeapFree( GetProcessHeap(), 0, xs->lpszName ); - if (xs->lpszClass) HeapFree( GetProcessHeap(), 0, xs->lpszClass ); + HeapFree( GetProcessHeap(), 0, xs->lpszName ); + HeapFree( GetProcessHeap(), 0, xs->lpszClass ); if (GetWindowLongW(hwnd, GWL_EXSTYLE) & WS_EX_MDICHILD) { -- 2.11.4.GIT