Marcus Meissner : ole32: Some missing error checking in FileMonikerImpl_CommonPrefixWith (Coverity) .

Alexandre Julliard julliard at winehq.org
Tue Nov 24 12:40:21 CST 2009


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

Author: Marcus Meissner <marcus at jet.franken.de>
Date:   Mon Nov 23 22:23:36 2009 +0100

ole32: Some missing error checking in FileMonikerImpl_CommonPrefixWith (Coverity).

---

 dlls/ole32/filemoniker.c |   18 +++++++++++++++---
 1 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/dlls/ole32/filemoniker.c b/dlls/ole32/filemoniker.c
index c179b7f..ff543aa 100644
--- a/dlls/ole32/filemoniker.c
+++ b/dlls/ole32/filemoniker.c
@@ -960,20 +960,32 @@ FileMonikerImpl_CommonPrefixWith(IMoniker* iface,IMoniker* pmkOther,IMoniker** p
     if(mkSys==MKSYS_FILEMONIKER){
         HRESULT ret;
 
-        CreateBindCtx(0,&pbind);
+        ret = CreateBindCtx(0,&pbind);
+        if (FAILED(ret))
+            return ret;
 
         /* create a string based on common part of the two paths */
 
-        IMoniker_GetDisplayName(iface,pbind,NULL,&pathThis);
-        IMoniker_GetDisplayName(pmkOther,pbind,NULL,&pathOther);
+        ret = IMoniker_GetDisplayName(iface,pbind,NULL,&pathThis);
+        if (FAILED(ret))
+            return ret;
+        ret = IMoniker_GetDisplayName(pmkOther,pbind,NULL,&pathOther);
+        if (FAILED(ret))
+            return ret;
 
         nb1=FileMonikerImpl_DecomposePath(pathThis,&stringTable1);
+        if (FAILED(nb1))
+            return nb1;
         nb2=FileMonikerImpl_DecomposePath(pathOther,&stringTable2);
+        if (FAILED(nb2))
+            return nb2;
 
         if (nb1==0 || nb2==0)
             return MK_E_NOPREFIX;
 
         commonPath=HeapAlloc(GetProcessHeap(),0,sizeof(WCHAR)*(min(lstrlenW(pathThis),lstrlenW(pathOther))+1));
+        if (!commonPath)
+            return E_OUTOFMEMORY;
 
         *commonPath=0;
 




More information about the wine-cvs mailing list