Robert Shearman : rpcrt4: Use I_Rpc{Allocate, Free} instead of Heap{Alloc, Free} as that

Alexandre Julliard julliard at wine.codeweavers.com
Tue Oct 3 10:04:48 CDT 2006


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

Author: Robert Shearman <rob at codeweavers.com>
Date:   Tue Oct  3 14:40:48 2006 +0100

rpcrt4: Use I_Rpc{Allocate, Free} instead of Heap{Alloc, Free} as that
the former are exported by rpcrt4 seemingly to allow callers of tower
functions to free the allocated memory.

---

 dlls/rpcrt4/rpc_transport.c |   28 ++++++++++++++--------------
 1 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/dlls/rpcrt4/rpc_transport.c b/dlls/rpcrt4/rpc_transport.c
index c8abb18..a627119 100644
--- a/dlls/rpcrt4/rpc_transport.c
+++ b/dlls/rpcrt4/rpc_transport.c
@@ -181,14 +181,14 @@ static RPC_STATUS rpcrt4_ncalrpc_open(Rp
 
   /* protseq=ncalrpc: supposed to use NT LPC ports,
    * but we'll implement it with named pipes for now */
-  pname = HeapAlloc(GetProcessHeap(), 0, strlen(prefix) + strlen(Connection->Endpoint) + 1);
+  pname = I_RpcAllocate(strlen(prefix) + strlen(Connection->Endpoint) + 1);
   strcat(strcpy(pname, prefix), Connection->Endpoint);
 
   if (Connection->server)
     r = rpcrt4_connect_pipe(Connection, pname);
   else
     r = rpcrt4_open_pipe(Connection, pname, TRUE);
-  HeapFree(GetProcessHeap(), 0, pname);
+  I_RpcFree(pname);
 
   return r;
 }
@@ -205,13 +205,13 @@ static RPC_STATUS rpcrt4_ncacn_np_open(R
     return RPC_S_OK;
 
   /* protseq=ncacn_np: named pipes */
-  pname = HeapAlloc(GetProcessHeap(), 0, strlen(prefix) + strlen(Connection->Endpoint) + 1);
+  pname = I_RpcAllocate(strlen(prefix) + strlen(Connection->Endpoint) + 1);
   strcat(strcpy(pname, prefix), Connection->Endpoint);
   if (Connection->server)
     r = rpcrt4_connect_pipe(Connection, pname);
   else
     r = rpcrt4_open_pipe(Connection, pname, FALSE);
-  HeapFree(GetProcessHeap(), 0, pname);
+  I_RpcFree(pname);
 
   return r;
 }
@@ -339,7 +339,7 @@ static RPC_STATUS rpcrt4_ncacn_np_parse_
 
     if (endpoint)
     {
-        *endpoint = HeapAlloc(GetProcessHeap(), 0, smb_floor->count_rhs);
+        *endpoint = I_RpcAllocate(smb_floor->count_rhs);
         if (!*endpoint)
             return RPC_S_OUT_OF_RESOURCES;
         memcpy(*endpoint, tower_data, smb_floor->count_rhs);
@@ -362,12 +362,12 @@ static RPC_STATUS rpcrt4_ncacn_np_parse_
 
     if (networkaddr)
     {
-        *networkaddr = HeapAlloc(GetProcessHeap(), 0, nb_floor->count_rhs);
+        *networkaddr = I_RpcAllocate(nb_floor->count_rhs);
         if (!*networkaddr)
         {
             if (endpoint)
             {
-                HeapFree(GetProcessHeap(), 0, *endpoint);
+                I_RpcFree(*endpoint);
                 *endpoint = NULL;
             }
             return RPC_S_OUT_OF_RESOURCES;
@@ -433,7 +433,7 @@ static RPC_STATUS rpcrt4_ncalrpc_parse_t
 
     if (endpoint)
     {
-        *endpoint = HeapAlloc(GetProcessHeap(), 0, pipe_floor->count_rhs);
+        *endpoint = I_RpcAllocate(pipe_floor->count_rhs);
         if (!*endpoint)
             return RPC_S_OUT_OF_RESOURCES;
         memcpy(*endpoint, tower_data, pipe_floor->count_rhs);
@@ -673,7 +673,7 @@ static RPC_STATUS rpcrt4_ncacn_ip_tcp_pa
 
     if (endpoint)
     {
-        *endpoint = HeapAlloc(GetProcessHeap(), 0, 6);
+        *endpoint = I_RpcAllocate(6 /* sizeof("65535") + 1 */);
         if (!*endpoint)
             return RPC_S_OUT_OF_RESOURCES;
         sprintf(*endpoint, "%u", ntohs(tcp_floor->port));
@@ -681,12 +681,12 @@ static RPC_STATUS rpcrt4_ncacn_ip_tcp_pa
 
     if (networkaddr)
     {
-        *networkaddr = HeapAlloc(GetProcessHeap(), 0, INET_ADDRSTRLEN);
+        *networkaddr = I_RpcAllocate(INET_ADDRSTRLEN);
         if (!*networkaddr)
         {
             if (endpoint)
             {
-                HeapFree(GetProcessHeap(), 0, *endpoint);
+                I_RpcFree(*endpoint);
                 *endpoint = NULL;
             }
             return RPC_S_OUT_OF_RESOURCES;
@@ -695,11 +695,11 @@ static RPC_STATUS rpcrt4_ncacn_ip_tcp_pa
         if (!inet_ntop(AF_INET, &in_addr, *networkaddr, INET_ADDRSTRLEN))
         {
             ERR("inet_ntop: %s\n", strerror(errno));
-            HeapFree(GetProcessHeap(), 0, *networkaddr);
+            I_RpcFree(*networkaddr);
             *networkaddr = NULL;
             if (endpoint)
             {
-                HeapFree(GetProcessHeap(), 0, *endpoint);
+                I_RpcFree(*endpoint);
                 *endpoint = NULL;
             }
             return EPT_S_NOT_REGISTERED;
@@ -949,7 +949,7 @@ RPC_STATUS RpcTransport_ParseTopOfTower(
 
     if ((status == RPC_S_OK) && protseq)
     {
-        *protseq = HeapAlloc(GetProcessHeap(), 0, strlen(protseq_ops->name) + 1);
+        *protseq = I_RpcAllocate(strlen(protseq_ops->name) + 1);
         strcpy(*protseq, protseq_ops->name);
     }
 




More information about the wine-cvs mailing list