[PATCH] dmime: added missing NULL ptr check (Coverity)
Marcus Meissner
marcus at jet.franken.de
Sat Jan 31 16:40:05 CST 2009
Hi,
CID 148, a bad chunk order could cause pNewItem to be
NULL here, check for it.
Ciao, Marcus
---
dlls/dmime/segtriggertrack.c | 10 +++++++++-
1 files changed, 9 insertions(+), 1 deletions(-)
diff --git a/dlls/dmime/segtriggertrack.c b/dlls/dmime/segtriggertrack.c
index 1f9e784..16fd3c3 100644
--- a/dlls/dmime/segtriggertrack.c
+++ b/dlls/dmime/segtriggertrack.c
@@ -274,7 +274,7 @@ static HRESULT IDirectMusicSegTriggerTrack_IPersistStream_ParseSegment (LPPERSIS
TRACE_(dmfile)(": segment item chunk\n");
/** alloc new item entry */
pNewItem = HeapAlloc (GetProcessHeap (), HEAP_ZERO_MEMORY, sizeof(DMUS_PRIVATE_SEGMENT_ITEM));
- if (NULL == pNewItem) {
+ if (!pNewItem) {
ERR(": no more memory\n");
return E_OUTOFMEMORY;
}
@@ -288,6 +288,10 @@ static HRESULT IDirectMusicSegTriggerTrack_IPersistStream_ParseSegment (LPPERSIS
}
case DMUS_FOURCC_SEGMENTITEMNAME_CHUNK: {
TRACE_(dmfile)(": segment item name chunk\n");
+ if (!pNewItem) {
+ ERR(": pNewItem not allocated, bad chunk order?\n");
+ return E_FAIL;
+ }
IStream_Read (pStm, pNewItem->wszName, Chunk.dwSize, NULL);
TRACE_(dmfile)(" - name: %s\n", debugstr_w(pNewItem->wszName));
break;
@@ -305,6 +309,10 @@ static HRESULT IDirectMusicSegTriggerTrack_IPersistStream_ParseSegment (LPPERSIS
ERR(": could not load Reference\n");
return hr;
}
+ if (!pNewItem) {
+ ERR(": pNewItem not allocated, bad chunk order?\n");
+ return E_FAIL;
+ }
pNewItem->pObject = pObject;
break;
}
--
1.5.6
More information about the wine-patches
mailing list