Remove more redundant NULL checks before HeapFree (found by Smatch).
Michael Stefaniuc
mstefani at redhat.de
Wed Jun 7 03:55:33 CDT 2006
Hello,
while working on an other Smatch script I found out that the
redundant_null_check.pl script didn't catch this style of redundant NULL
checks before HeapFree/RtlFreeHeap (fixed).
bye
michael
---
dlls/advpack/install.c | 2 +-
dlls/setupapi/install.c | 2 +-
dlls/shlwapi/assoc.c | 12 ++++++------
dlls/x11drv/dib.c | 2 +-
programs/regedit/listview.c | 2 +-
5 files changed, 10 insertions(+), 10 deletions(-)
6e9071cb856a30837d5910ab8600709155560c9c
diff --git a/dlls/advpack/install.c b/dlls/advpack/install.c
index 093f0e5..20441cf 100644
--- a/dlls/advpack/install.c
+++ b/dlls/advpack/install.c
@@ -274,7 +274,7 @@ static HRESULT iterate_section_fields(HI
hr = S_OK;
done:
- if (buffer && buffer != static_buffer) HeapFree(GetProcessHeap(), 0, buffer);
+ if (buffer != static_buffer) HeapFree(GetProcessHeap(), 0, buffer);
return hr;
}
diff --git a/dlls/setupapi/install.c b/dlls/setupapi/install.c
index 78c472e..591e9e6 100644
--- a/dlls/setupapi/install.c
+++ b/dlls/setupapi/install.c
@@ -787,7 +787,7 @@ static BOOL iterate_section_fields( HINF
}
ret = TRUE;
done:
- if (buffer && buffer != static_buffer) HeapFree( GetProcessHeap(), 0, buffer );
+ if (buffer != static_buffer) HeapFree( GetProcessHeap(), 0, buffer );
return ret;
}
diff --git a/dlls/shlwapi/assoc.c b/dlls/shlwapi/assoc.c
index 741d99d..8f3827f 100644
--- a/dlls/shlwapi/assoc.c
+++ b/dlls/shlwapi/assoc.c
@@ -220,10 +220,10 @@ HRESULT WINAPI AssocQueryKeyA(ASSOCF cfF
hRet = AssocQueryKeyW(cfFlags, assockey, lpszAssocW, lpszExtraW, phkeyOut);
}
- if (lpszAssocW && lpszAssocW != szAssocW)
+ if (lpszAssocW != szAssocW)
HeapFree(GetProcessHeap(), 0, lpszAssocW);
- if (lpszExtraW && lpszExtraW != szExtraW)
+ if (lpszExtraW != szExtraW)
HeapFree(GetProcessHeap(), 0, lpszExtraW);
return hRet;
@@ -312,14 +312,14 @@ HRESULT WINAPI AssocQueryStringA(ASSOCF
WideCharToMultiByte(CP_ACP,0,szReturnW,-1,pszOut,dwLenOut,0,0);
*pcchOut = dwLenOut;
- if (lpszReturnW && lpszReturnW != szReturnW)
+ if (lpszReturnW != szReturnW)
HeapFree(GetProcessHeap(), 0, lpszReturnW);
}
}
- if (lpszAssocW && lpszAssocW != szAssocW)
+ if (lpszAssocW != szAssocW)
HeapFree(GetProcessHeap(), 0, lpszAssocW);
- if (lpszExtraW && lpszExtraW != szExtraW)
+ if (lpszExtraW != szExtraW)
HeapFree(GetProcessHeap(), 0, lpszExtraW);
return hRet;
}
@@ -406,7 +406,7 @@ HRESULT WINAPI AssocQueryStringByKeyA(AS
}
}
- if (lpszExtraW && lpszExtraW != szExtraW)
+ if (lpszExtraW != szExtraW)
HeapFree(GetProcessHeap(), 0, lpszExtraW);
return hRet;
}
diff --git a/dlls/x11drv/dib.c b/dlls/x11drv/dib.c
index 0d53c1d..51f57c8 100644
--- a/dlls/x11drv/dib.c
+++ b/dlls/x11drv/dib.c
@@ -4157,7 +4157,7 @@ #endif
info->bmiHeader.biCompression = 0;
}
- if(descr.colorMap && descr.colorMap != colorPtr)
+ if(descr.colorMap != colorPtr)
HeapFree(GetProcessHeap(), 0, descr.colorMap);
return lines;
}
diff --git a/programs/regedit/listview.c b/programs/regedit/listview.c
index cddeea0..8b96068 100644
--- a/programs/regedit/listview.c
+++ b/programs/regedit/listview.c
@@ -81,7 +81,7 @@ LPCTSTR GetValueName(HWND hwndLV)
{
INT item;
- if (g_valueName && g_valueName != LPSTR_TEXTCALLBACK)
+ if (g_valueName != LPSTR_TEXTCALLBACK)
HeapFree(GetProcessHeap(), 0, g_valueName);
g_valueName = NULL;
--
1.3.3
--
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/20060607/de6196ea/attachment.pgp
More information about the wine-patches
mailing list