Janitorial: Removed the rest of the redundant NULL checks before HeapFree. MyFree is only a wrapper around HeapFree. Found by Smatch.

Michael Stefaniuc mstefani at redhat.de
Wed Aug 9 15:34:56 CDT 2006


Well, all known redundant NULL checks. I already have an idea to improve
the redundant_null_check.pl Smatch script further ... ;)

bye
	michael

---
 dlls/ddraw/main.c           |    2 +-
 dlls/gdi/font.c             |    2 +-
 dlls/setupapi/misc.c        |    3 +--
 dlls/setupapi/stringtable.c |   16 +++++-----------
 4 files changed, 8 insertions(+), 15 deletions(-)

diff --git a/dlls/ddraw/main.c b/dlls/ddraw/main.c
index e654dd7..1868ef2 100644
--- a/dlls/ddraw/main.c
+++ b/dlls/ddraw/main.c
@@ -313,7 +313,7 @@ err_out:
     /* Let's hope we never need this ;) */
     if(wineD3DDevice) IWineD3DDevice_Release(wineD3DDevice);
     if(wineD3D) IWineD3D_Release(wineD3D);
-    if(This) HeapFree(GetProcessHeap(), 0, This);
+    HeapFree(GetProcessHeap(), 0, This);
     return hr;
 }
 
diff --git a/dlls/gdi/font.c b/dlls/gdi/font.c
index 16e7f7b..ec9074d 100644
--- a/dlls/gdi/font.c
+++ b/dlls/gdi/font.c
@@ -1243,7 +1243,7 @@ BOOL WINAPI GetTextExtentExPointW( HDC h
     if (lpnFit)
 	*lpnFit = nFit;
 
-    if (dxs && ! alpDx)
+    if (! alpDx)
         HeapFree(GetProcessHeap(), 0, dxs);
 
     GDI_ReleaseObj( hdc );
diff --git a/dlls/setupapi/misc.c b/dlls/setupapi/misc.c
index f9b1d86..c29da52 100644
--- a/dlls/setupapi/misc.c
+++ b/dlls/setupapi/misc.c
@@ -767,8 +767,7 @@ DWORD WINAPI TakeOwnershipOfFile(LPCWSTR
 fail:;
     dwError = GetLastError();
 
-    if (pOwner != NULL)
-        MyFree(pOwner);
+    MyFree(pOwner);
 
     if (hToken != NULL)
         CloseHandle(hToken);
diff --git a/dlls/setupapi/stringtable.c b/dlls/setupapi/stringtable.c
index 35d6f40..8fb1964 100644
--- a/dlls/setupapi/stringtable.c
+++ b/dlls/setupapi/stringtable.c
@@ -172,18 +172,12 @@ StringTableDestroy(HSTRING_TABLE hString
     {
         for (i = 0; i < pStringTable->dwMaxSlots; i++)
         {
-            if (pStringTable->pSlots[i].pString != NULL)
-            {
-                MyFree(pStringTable->pSlots[i].pString);
-                pStringTable->pSlots[i].pString = NULL;
-            }
+            MyFree(pStringTable->pSlots[i].pString);
+            pStringTable->pSlots[i].pString = NULL;
 
-            if (pStringTable->pSlots[i].pData != NULL)
-            {
-                MyFree(pStringTable->pSlots[i].pData);
-                pStringTable->pSlots[i].pData = NULL;
-                pStringTable->pSlots[i].dwSize = 0;
-            }
+            MyFree(pStringTable->pSlots[i].pData);
+            pStringTable->pSlots[i].pData = NULL;
+            pStringTable->pSlots[i].dwSize = 0;
         }
 
         MyFree(pStringTable->pSlots);
-- 
1.4.1


-- 
Michael Stefaniuc               Tel.: +49-711-96437-199
Sr. Network Engineer            Fax.: +49-711-96437-111
Red Hat GmbH                    Email: mstefani at redhat.com
Hauptstaetterstr. 58            http://www.redhat.de/
D-70178 Stuttgart
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://www.winehq.org/pipermail/wine-patches/attachments/20060809/6607ee5a/attachment.pgp


More information about the wine-patches mailing list