Robert Shearman : rpcrt4: Don' t set the memory pointer to NULL before calling PointerUnmarshall.

Alexandre Julliard julliard at wine.codeweavers.com
Sat May 20 11:22:52 CDT 2006


Module: wine
Branch: refs/heads/master
Commit: 19fad8e71032707cb036239f69f085e1b0249d01
URL:    http://source.winehq.org/git/?p=wine.git;a=commit;h=19fad8e71032707cb036239f69f085e1b0249d01

Author: Robert Shearman <rob at codeweavers.com>
Date:   Fri May 19 16:03:13 2006 +0100

rpcrt4: Don't set the memory pointer to NULL before calling PointerUnmarshall.

Call it with fMustAlloc set to TRUE instead to achieve the same result
without side-effects.

---

 dlls/rpcrt4/ndr_marshall.c |    9 +++------
 1 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/dlls/rpcrt4/ndr_marshall.c b/dlls/rpcrt4/ndr_marshall.c
index 15d7ae8..99777ea 100644
--- a/dlls/rpcrt4/ndr_marshall.c
+++ b/dlls/rpcrt4/ndr_marshall.c
@@ -1109,8 +1109,7 @@ static unsigned char * EmbeddedPointerUn
       for (u=0; u<count; u++,info+=8) {
         unsigned char *memptr = membase + *(const SHORT*)&info[0];
         unsigned char *bufptr = bufbase + *(const SHORT*)&info[2];
-        *(void **)memptr = NULL;
-        PointerUnmarshall(pStubMsg, bufptr, (unsigned char**)memptr, info+4, fMustAlloc);
+        PointerUnmarshall(pStubMsg, bufptr, (unsigned char**)memptr, info+4, TRUE);
       }
     }
     pFormat += 8 * count;
@@ -1667,9 +1666,8 @@ static unsigned char * ComplexUnmarshall
       pMemory += 4;
       break;
     case RPC_FC_POINTER:
-      *(unsigned char**)pMemory = NULL;
       TRACE("pointer => %p\n", pMemory);
-      NdrPointerUnmarshall(pStubMsg, (unsigned char**)pMemory, pPointer, fMustAlloc);
+      NdrPointerUnmarshall(pStubMsg, (unsigned char**)pMemory, pPointer, TRUE);
       pPointer += 4;
       pMemory += 4;
       break;
@@ -3767,11 +3765,10 @@ unsigned char *  WINAPI NdrNonEncapsulat
             case RPC_FC_UP:
             case RPC_FC_OP:
             case RPC_FC_FP:
-                **(void***)ppMemory = NULL;
                 ALIGN_POINTER(pStubMsg->Buffer, 4);
                 saved_buffer = pStubMsg->Buffer;
                 pStubMsg->Buffer += 4; /* for pointer ID */
-                PointerUnmarshall(pStubMsg, saved_buffer, *(unsigned char ***)ppMemory, desc, fMustAlloc);
+                PointerUnmarshall(pStubMsg, saved_buffer, *(unsigned char ***)ppMemory, desc, TRUE);
                 break;
             default:
                 m(pStubMsg, ppMemory, desc, fMustAlloc);




More information about the wine-cvs mailing list