oleaut32: Remove redundant NULL check before SysFreeString (Smatch).
Michael Stefaniuc
mstefani at redhat.de
Wed Sep 24 16:04:49 CDT 2008
---
dlls/oleaut32/oleaut.c | 3 +--
dlls/oleaut32/safearray.c | 6 ++----
dlls/oleaut32/usrmarshal.c | 16 +++++-----------
dlls/oleaut32/variant.c | 3 +--
4 files changed, 9 insertions(+), 19 deletions(-)
diff --git a/dlls/oleaut32/oleaut.c b/dlls/oleaut32/oleaut.c
index aa97b31..4e636e3 100644
--- a/dlls/oleaut32/oleaut.c
+++ b/dlls/oleaut32/oleaut.c
@@ -419,8 +419,7 @@ INT WINAPI SysReAllocString(LPBSTR old,LPCOLESTR str)
/*
* Make sure we free the old string.
*/
- if (*old!=NULL)
- SysFreeString(*old);
+ SysFreeString(*old);
/*
* Allocate the new string
diff --git a/dlls/oleaut32/safearray.c b/dlls/oleaut32/safearray.c
index a19d599..bf82a5a 100644
--- a/dlls/oleaut32/safearray.c
+++ b/dlls/oleaut32/safearray.c
@@ -314,8 +314,7 @@ static HRESULT SAFEARRAY_DestroyData(SAFEARRAY *psa, ULONG ulStartCell)
while(ulCellCount--)
{
- if (*lpBstr)
- SysFreeString(*lpBstr);
+ SysFreeString(*lpBstr);
lpBstr++;
}
}
@@ -865,8 +864,7 @@ HRESULT WINAPI SafeArrayPutElement(SAFEARRAY *psa, LONG *rgIndices, void *pvData
BSTR lpBstr = (BSTR)pvData;
BSTR* lpDest = (BSTR*)lpvDest;
- if (*lpDest)
- SysFreeString(*lpDest);
+ SysFreeString(*lpDest);
*lpDest = SysAllocStringByteLen((char*)lpBstr, SysStringByteLen(lpBstr));
if (!*lpDest)
diff --git a/dlls/oleaut32/usrmarshal.c b/dlls/oleaut32/usrmarshal.c
index ea5f49e..8f55f8f 100644
--- a/dlls/oleaut32/usrmarshal.c
+++ b/dlls/oleaut32/usrmarshal.c
@@ -186,12 +186,9 @@ unsigned char * WINAPI BSTR_UserUnmarshal(ULONG *pFlags, unsigned char *Buffer,
header = (bstr_wire_t*)Buffer;
if(header->len != header->len2)
FIXME("len %08x != len2 %08x\n", header->len, header->len2);
-
- if(*pstr)
- {
- SysFreeString(*pstr);
- *pstr = NULL;
- }
+
+ SysFreeString(*pstr);
+ *pstr = NULL;
if(header->byte_len != 0xffffffff)
*pstr = SysAllocStringByteLen((char*)(header + 1), header->byte_len);
@@ -203,11 +200,8 @@ unsigned char * WINAPI BSTR_UserUnmarshal(ULONG *pFlags, unsigned char *Buffer,
void WINAPI BSTR_UserFree(ULONG *pFlags, BSTR *pstr)
{
TRACE("(%x,%p) => %p\n", *pFlags, pstr, *pstr);
- if (*pstr)
- {
- SysFreeString(*pstr);
- *pstr = NULL;
- }
+ SysFreeString(*pstr);
+ *pstr = NULL;
}
/* VARIANT */
diff --git a/dlls/oleaut32/variant.c b/dlls/oleaut32/variant.c
index 5c094e1..f6dcbf1 100644
--- a/dlls/oleaut32/variant.c
+++ b/dlls/oleaut32/variant.c
@@ -608,8 +608,7 @@ HRESULT WINAPI VariantClear(VARIANTARG* pVarg)
}
else if (V_VT(pVarg) == VT_BSTR)
{
- if (V_BSTR(pVarg))
- SysFreeString(V_BSTR(pVarg));
+ SysFreeString(V_BSTR(pVarg));
}
else if (V_VT(pVarg) == VT_RECORD)
{
--
1.6.0.1
-------------- 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/20080924/acfcc061/attachment.pgp
More information about the wine-patches
mailing list