diff --git a/randr/rrcrtc.c b/randr/rrcrtc.c index fe96a9bcf3..e903ff4e9c 100644 --- a/randr/rrcrtc.c +++ b/randr/rrcrtc.c @@ -1676,13 +1676,16 @@ ProcRRGetCrtcGamma(ClientPtr client) swapl(&reply.length); swaps(&reply.size); } - WriteToClient(client, sizeof(xRRGetCrtcGammaReply), &reply); if (crtc->gammaSize) { memcpy(extra, crtc->gammaRed, len); - client->pSwapReplyFunc = (ReplySwapPtr) CopySwap16Write; - WriteSwappedDataToClient(client, len, extra); - free(extra); + if (client->swapped) SwapShorts((short*)extra, len/sizeof(CARD16)); } + + WriteToClient(client, sizeof(xRRGetCrtcGammaReply), &reply); + WriteToClient(client, len, extra); + + if (extra) free(extra); + return Success; }