Marcus Meissner : oleaut32: Check a return value (Coverity).

Alexandre Julliard julliard at winehq.org
Wed Jul 3 15:02:19 CDT 2013


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

Author: Marcus Meissner <meissner at suse.de>
Date:   Tue Jul  2 15:45:04 2013 +0200

oleaut32: Check a return value (Coverity).

---

 dlls/oleaut32/usrmarshal.c |   11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/dlls/oleaut32/usrmarshal.c b/dlls/oleaut32/usrmarshal.c
index 495c257..0b541e4 100644
--- a/dlls/oleaut32/usrmarshal.c
+++ b/dlls/oleaut32/usrmarshal.c
@@ -1070,15 +1070,16 @@ unsigned char * WINAPI LPSAFEARRAY_UserUnmarshal(ULONG *pFlags, unsigned char *B
     Buffer += sizeof(wiresab[0]) * wiresa->cDims;
 
     if(vt)
+    {
         *ppsa = SafeArrayCreateEx(vt, wiresa->cDims, wiresab, NULL);
+        if (!*ppsa) RpcRaiseException(E_OUTOFMEMORY);
+    }
     else
     {
-        SafeArrayAllocDescriptor(wiresa->cDims, ppsa);
-        if(*ppsa)
-            memcpy((*ppsa)->rgsabound, wiresab, sizeof(SAFEARRAYBOUND) * wiresa->cDims);
+        if (FAILED(SafeArrayAllocDescriptor(wiresa->cDims, ppsa)))
+            RpcRaiseException(E_OUTOFMEMORY);
+        memcpy((*ppsa)->rgsabound, wiresab, sizeof(SAFEARRAYBOUND) * wiresa->cDims);
     }
-    if (!*ppsa)
-        RpcRaiseException(E_OUTOFMEMORY);
 
     /* be careful about which flags we set since they could be a security
      * risk */




More information about the wine-cvs mailing list