Marcus Meissner : dmime: Added missing NULL ptr check (Coverity).

Alexandre Julliard julliard at winehq.org
Mon Feb 2 09:01:26 CST 2009


Module: wine
Branch: master
Commit: 3ce650bfd0b82b750d0e79539a14440348018a3d
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=3ce650bfd0b82b750d0e79539a14440348018a3d

Author: Marcus Meissner <marcus at jet.franken.de>
Date:   Sat Jan 31 23:40:05 2009 +0100

dmime: Added missing NULL ptr check (Coverity).

---

 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;						
       }




More information about the wine-cvs mailing list