glx: Eliminate a small malloc from QueryContext
No reason to have that be a failure path. Reviewed-by: Eric Anholt <eric@anholt.net> Signed-off-by: Adam Jackson <ajax@redhat.com>
This commit is contained in:
parent
b99f797540
commit
9ebf739a68
|
@ -1687,15 +1687,14 @@ DoQueryContext(__GLXclientState * cl, GLXContextID gcId)
|
||||||
ClientPtr client = cl->client;
|
ClientPtr client = cl->client;
|
||||||
__GLXcontext *ctx;
|
__GLXcontext *ctx;
|
||||||
xGLXQueryContextInfoEXTReply reply;
|
xGLXQueryContextInfoEXTReply reply;
|
||||||
int nProps;
|
int nProps = 3;
|
||||||
int *sendBuf, *pSendBuf;
|
int sendBuf[nProps * 2];
|
||||||
int nReplyBytes;
|
int nReplyBytes;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
if (!validGlxContext(cl->client, gcId, DixReadAccess, &ctx, &err))
|
if (!validGlxContext(cl->client, gcId, DixReadAccess, &ctx, &err))
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
nProps = 3;
|
|
||||||
reply = (xGLXQueryContextInfoEXTReply) {
|
reply = (xGLXQueryContextInfoEXTReply) {
|
||||||
.type = X_Reply,
|
.type = X_Reply,
|
||||||
.sequenceNumber = client->sequence,
|
.sequenceNumber = client->sequence,
|
||||||
|
@ -1704,17 +1703,12 @@ DoQueryContext(__GLXclientState * cl, GLXContextID gcId)
|
||||||
};
|
};
|
||||||
|
|
||||||
nReplyBytes = reply.length << 2;
|
nReplyBytes = reply.length << 2;
|
||||||
sendBuf = (int *) malloc((size_t) nReplyBytes);
|
sendBuf[0] = GLX_SHARE_CONTEXT_EXT;
|
||||||
if (sendBuf == NULL) {
|
sendBuf[1] = (int) (ctx->share_id);
|
||||||
return __glXError(GLXBadContext); /* XXX: Is this correct? */
|
sendBuf[2] = GLX_VISUAL_ID_EXT;
|
||||||
}
|
sendBuf[3] = (int) (ctx->config->visualID);
|
||||||
pSendBuf = sendBuf;
|
sendBuf[4] = GLX_SCREEN_EXT;
|
||||||
*pSendBuf++ = GLX_SHARE_CONTEXT_EXT;
|
sendBuf[5] = (int) (ctx->pGlxScreen->pScreen->myNum);
|
||||||
*pSendBuf++ = (int) (ctx->share_id);
|
|
||||||
*pSendBuf++ = GLX_VISUAL_ID_EXT;
|
|
||||||
*pSendBuf++ = (int) (ctx->config->visualID);
|
|
||||||
*pSendBuf++ = GLX_SCREEN_EXT;
|
|
||||||
*pSendBuf++ = (int) (ctx->pGlxScreen->pScreen->myNum);
|
|
||||||
|
|
||||||
if (client->swapped) {
|
if (client->swapped) {
|
||||||
__glXSwapQueryContextInfoEXTReply(client, &reply, sendBuf);
|
__glXSwapQueryContextInfoEXTReply(client, &reply, sendBuf);
|
||||||
|
@ -1723,7 +1717,6 @@ DoQueryContext(__GLXclientState * cl, GLXContextID gcId)
|
||||||
WriteToClient(client, sz_xGLXQueryContextInfoEXTReply, &reply);
|
WriteToClient(client, sz_xGLXQueryContextInfoEXTReply, &reply);
|
||||||
WriteToClient(client, nReplyBytes, sendBuf);
|
WriteToClient(client, nReplyBytes, sendBuf);
|
||||||
}
|
}
|
||||||
free((char *) sendBuf);
|
|
||||||
|
|
||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue