summaryrefslogtreecommitdiff
path: root/record
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2011-11-08 10:13:15 -0800
committerKeith Packard <keithp@keithp.com>2011-12-01 15:11:20 +0000
commitfb22a408c69a84f81905147de9e82cf66ffb6eb2 (patch)
tree31940825720420898c4bf9d793560b54642692a3 /record
parent05f09354a30a4f5edd421220e1aa97be754c71bb (diff)
Save major/minor opcodes in ClientRec for RecordAReply
The record extension needs the major and minor opcodes in the reply hook, but the request buffer may have been freed by the time the hook is invoked. Saving the request major and minor codes as the request is executed avoids fetching from the defunct request buffer. This patch also eliminates the public MinorOpcodeOfRequest function, inlining it into Dispatch. Usages of that function have been replaced with direct access to the new ClientRec field. Signed-off-by: Keith Packard <keithp@keithp.com> Reviewed-by: Jamey Sharp <jamey@minilop.net>
Diffstat (limited to 'record')
-rw-r--r--record/record.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/record/record.c b/record/record.c
index db77b64f5..b956b4ab8 100644
--- a/record/record.c
+++ b/record/record.c
@@ -552,7 +552,7 @@ RecordARequest(ClientPtr client)
}
else /* extension, check minor opcode */
{
- int minorop = MinorOpcodeOfRequest(client);
+ int minorop = client->minorOp;
int numMinOpInfo;
RecordMinorOpPtr pMinorOpInfo = pRCAP->pRequestMinOpInfo;
@@ -609,12 +609,9 @@ RecordAReply(CallbackListPtr *pcbl, pointer nulldata, pointer calldata)
RecordContextPtr pContext;
RecordClientsAndProtocolPtr pRCAP;
int eci;
- int majorop;
ReplyInfoRec *pri = (ReplyInfoRec *)calldata;
ClientPtr client = pri->client;
- REQUEST(xReq);
- majorop = stuff->reqType;
for (eci = 0; eci < numEnabledContexts; eci++)
{
pContext = ppAllContexts[eci];
@@ -622,6 +619,7 @@ RecordAReply(CallbackListPtr *pcbl, pointer nulldata, pointer calldata)
NULL);
if (pRCAP)
{
+ int majorop = client->majorOp;
if (pContext->continuedReply)
{
RecordAProtocolElement(pContext, client, XRecordFromServer,
@@ -642,7 +640,7 @@ RecordAReply(CallbackListPtr *pcbl, pointer nulldata, pointer calldata)
}
else /* extension, check minor opcode */
{
- int minorop = MinorOpcodeOfRequest(client);
+ int minorop = client->minorOp;
int numMinOpInfo;
RecordMinorOpPtr pMinorOpInfo = pRCAP->pReplyMinOpInfo;
assert (pMinorOpInfo);