Commit 00d0406c authored by Ove Kaaven's avatar Ove Kaaven Committed by Alexandre Julliard

Avoid freeing request packet too early if an exception occurs.

parent cb6c83df
...@@ -178,11 +178,18 @@ static RpcPacket* RPCRT4_pop_packet(void) ...@@ -178,11 +178,18 @@ static RpcPacket* RPCRT4_pop_packet(void)
return packet; return packet;
} }
typedef struct {
PRPC_MESSAGE msg;
void* buf;
} packet_state;
static WINE_EXCEPTION_FILTER(rpc_filter) static WINE_EXCEPTION_FILTER(rpc_filter)
{ {
packet_state* state;
PRPC_MESSAGE msg; PRPC_MESSAGE msg;
msg = TlsGetValue(worker_tls); state = TlsGetValue(worker_tls);
I_RpcFreeBuffer(msg); msg = state->msg;
if (msg->Buffer != state->buf) I_RpcFreeBuffer(msg);
msg->RpcFlags |= WINE_RPCFLAG_EXCEPTION; msg->RpcFlags |= WINE_RPCFLAG_EXCEPTION;
msg->BufferLength = sizeof(DWORD); msg->BufferLength = sizeof(DWORD);
I_RpcGetBuffer(msg); I_RpcGetBuffer(msg);
...@@ -196,8 +203,11 @@ static void RPCRT4_process_packet(RpcConnection* conn, RpcPktHdr* hdr, void* buf ...@@ -196,8 +203,11 @@ static void RPCRT4_process_packet(RpcConnection* conn, RpcPktHdr* hdr, void* buf
RPC_MESSAGE msg; RPC_MESSAGE msg;
RpcServerInterface* sif; RpcServerInterface* sif;
RPC_DISPATCH_FUNCTION func; RPC_DISPATCH_FUNCTION func;
packet_state state;
TlsSetValue(worker_tls, &msg); state.msg = &msg;
state.buf = buf;
TlsSetValue(worker_tls, &state);
memset(&msg, 0, sizeof(msg)); memset(&msg, 0, sizeof(msg));
msg.BufferLength = hdr->len; msg.BufferLength = hdr->len;
msg.Buffer = buf; msg.Buffer = buf;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment