Marcus Meissner : dmstyle: Another NULL ptr check added (Coverity).

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


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

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

dmstyle: Another NULL ptr check added (Coverity).

---

 dlls/dmstyle/style.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/dlls/dmstyle/style.c b/dlls/dmstyle/style.c
index 79c3fdd..eb6e77c 100644
--- a/dlls/dmstyle/style.c
+++ b/dlls/dmstyle/style.c
@@ -500,9 +500,9 @@ static HRESULT IDirectMusicStyle8Impl_IPersistStream_ParsePartRefList (LPPERSIST
     case DMUS_FOURCC_PARTREF_CHUNK: {
       TRACE_(dmfile)(": PartRef chunk\n");
       pNewItem = HeapAlloc (GetProcessHeap (), HEAP_ZERO_MEMORY, sizeof(DMUS_PRIVATE_STYLE_PARTREF_ITEM));
-      if (NULL == pNewItem) {
+      if (!pNewItem) {
 	ERR(": no more memory\n");
-	return  E_OUTOFMEMORY;
+	return E_OUTOFMEMORY;
       }
       hr = IStream_Read (pStm, &pNewItem->part_ref, sizeof(DMUS_IO_PARTREF), NULL);
       /*TRACE_(dmfile)(" - sizeof %lu\n",  sizeof(DMUS_IO_PARTREF));*/
@@ -523,6 +523,10 @@ static HRESULT IDirectMusicStyle8Impl_IPersistStream_ParsePartRefList (LPPERSIST
 	  ListCount[1] += sizeof(FOURCC) + sizeof(DWORD) + Chunk.dwSize;
           TRACE_(dmfile)(": %s chunk (size = %d)", debugstr_fourcc (Chunk.fccID), Chunk.dwSize);
 	  
+          if (!pNewItem) {
+	    ERR(": pNewItem not yet allocated, chunk order bad?\n");
+	    return E_OUTOFMEMORY;
+          }
 	  hr = IDirectMusicUtils_IPersistStream_ParseUNFOGeneric(&Chunk, pStm, &pNewItem->desc);
 	  if (FAILED(hr)) return hr;
 	  




More information about the wine-cvs mailing list