Robert Shearman : rpcrt4: Don'
t use HEAP_ZERO_MEMORY when most of the fields will be initialised to
non-zero values .
Alexandre Julliard
julliard at wine.codeweavers.com
Tue Oct 3 10:04:47 CDT 2006
Module: wine
Branch: master
Commit: b9423076bafc788e643ca22e9878684c5b26c87c
URL: http://source.winehq.org/git/?p=wine.git;a=commit;h=b9423076bafc788e643ca22e9878684c5b26c87c
Author: Robert Shearman <rob at codeweavers.com>
Date: Tue Oct 3 14:40:57 2006 +0100
rpcrt4: Don't use HEAP_ZERO_MEMORY when most of the fields will be initialised to non-zero values.
---
dlls/rpcrt4/rpc_transport.c | 18 +++++++++++++++---
1 files changed, 15 insertions(+), 3 deletions(-)
diff --git a/dlls/rpcrt4/rpc_transport.c b/dlls/rpcrt4/rpc_transport.c
index 27b0d84..c8abb18 100644
--- a/dlls/rpcrt4/rpc_transport.c
+++ b/dlls/rpcrt4/rpc_transport.c
@@ -90,7 +90,14 @@ typedef struct _RpcConnection_np
static RpcConnection *rpcrt4_conn_np_alloc(void)
{
- return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(RpcConnection_np));
+ RpcConnection_np *npc = HeapAlloc(GetProcessHeap(), 0, sizeof(RpcConnection_np));
+ if (npc)
+ {
+ npc->pipe = NULL;
+ npc->thread = NULL;
+ memset(&npc->ovl, 0, sizeof(npc->ovl));
+ }
+ return &npc->common;
}
static RPC_STATUS rpcrt4_connect_pipe(RpcConnection *Connection, LPCSTR pname)
@@ -446,8 +453,9 @@ typedef struct _RpcConnection_tcp
static RpcConnection *rpcrt4_conn_tcp_alloc(void)
{
RpcConnection_tcp *tcpc;
- tcpc = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(RpcConnection_tcp));
- tcpc->sock = -1;
+ tcpc = HeapAlloc(GetProcessHeap(), 0, sizeof(RpcConnection_tcp));
+ if (tcpc)
+ tcpc->sock = -1;
return &tcpc->common;
}
@@ -779,13 +787,17 @@ RPC_STATUS RPCRT4_CreateConnection(RpcCo
return RPC_S_PROTSEQ_NOT_SUPPORTED;
NewConnection = ops->alloc();
+ NewConnection->Next = NULL;
NewConnection->server = server;
NewConnection->ops = ops;
NewConnection->NetworkAddr = RPCRT4_strdupA(NetworkAddr);
NewConnection->Endpoint = RPCRT4_strdupA(Endpoint);
NewConnection->Used = Binding;
NewConnection->MaxTransmissionSize = RPC_MAX_PACKET_SIZE;
+ memset(&NewConnection->ActiveInterface, 0, sizeof(NewConnection->ActiveInterface));
NewConnection->NextCallId = 1;
+
+ memset(&NewConnection->ctx, 0, sizeof(NewConnection->ctx));
if (AuthInfo) RpcAuthInfo_AddRef(AuthInfo);
NewConnection->AuthInfo = AuthInfo;
list_init(&NewConnection->conn_pool_entry);
More information about the wine-cvs
mailing list