[PATCH] CID495: dereference pointer after NULL check
Marcus Meissner
meissner at suse.de
Thu Feb 1 09:08:21 CST 2007
Coverity spotted that we dereference pdidoi before
checking it for NULL. Fixed.
Ciao, Marcus
---
dlls/dinput/device.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/dlls/dinput/device.c b/dlls/dinput/device.c
index 3a32ca5..ee3832b 100644
--- a/dlls/dinput/device.c
+++ b/dlls/dinput/device.c
@@ -955,7 +955,7 @@ HRESULT WINAPI IDirectInputDevice2WImpl_
DWORD dwHow)
{
IDirectInputDevice2AImpl *This = (IDirectInputDevice2AImpl *)iface;
- DWORD dwSize = pdidoi->dwSize;
+ DWORD dwSize;
LPDIOBJECTDATAFORMAT odf;
int idx = -1;
@@ -990,6 +990,7 @@ HRESULT WINAPI IDirectInputDevice2WImpl_
if (idx < 0) return DIERR_OBJECTNOTFOUND;
odf = dataformat_to_odf(This->data_format.wine_df, idx);
+ dwSize = pdidoi->dwSize; /* save due to memset below */
memset(pdidoi, 0, pdidoi->dwSize);
pdidoi->dwSize = dwSize;
if (odf->pguid) pdidoi->guidType = *odf->pguid;
--
1.4.3.4
More information about the wine-patches
mailing list