[PATCH] rpcrt4: move riid retrieval into if (pMemory) check (Coverity)

Marcus Meissner marcus at jet.franken.de
Sat Jan 31 13:06:31 CST 2009


Hi,

CID 371 says that get_ip_iid might crash if pMemory is NULL,
and since it is only moved at one place, move it inside the if().

Ciao, Marcus
---
 dlls/rpcrt4/ndr_ole.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/dlls/rpcrt4/ndr_ole.c b/dlls/rpcrt4/ndr_ole.c
index 729ab0b..0dea1e9 100644
--- a/dlls/rpcrt4/ndr_ole.c
+++ b/dlls/rpcrt4/ndr_ole.c
@@ -247,7 +247,6 @@ unsigned char * WINAPI NdrInterfacePointerMarshall(PMIDL_STUB_MESSAGE pStubMsg,
                                                   unsigned char *pMemory,
                                                   PFORMAT_STRING pFormat)
 {
-  const IID *riid = get_ip_iid(pStubMsg, pMemory, pFormat);
   LPSTREAM stream;
   HRESULT hr;
 
@@ -257,11 +256,12 @@ unsigned char * WINAPI NdrInterfacePointerMarshall(PMIDL_STUB_MESSAGE pStubMsg,
   if (pStubMsg->Buffer + sizeof(DWORD) <= (unsigned char *)pStubMsg->RpcMsg->Buffer + pStubMsg->BufferLength) {
     stream = RpcStream_Create(pStubMsg, TRUE);
     if (stream) {
-      if (pMemory)
+      if (pMemory) {
+        const IID *riid = get_ip_iid(pStubMsg, pMemory, pFormat);
         hr = COM_MarshalInterface(stream, riid, (LPUNKNOWN)pMemory,
                                   pStubMsg->dwDestContext, pStubMsg->pvDestContext,
                                   MSHLFLAGS_NORMAL);
-      else
+      } else
         hr = S_OK;
 
       IStream_Release(stream);
-- 
1.5.6



More information about the wine-patches mailing list