summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Jackson <ajax@redhat.com>2013-07-02 10:30:40 -0400
committerAdam Jackson <ajax@redhat.com>2013-09-11 14:37:32 -0400
commit9ebf739a6864c9ec38bf72f63ef2e3b9cd1951db (patch)
tree077d098b89b0094291031f61242c39dffa613577
parentb99f7975407f111b99d772cd28224d7dc1b34fe4 (diff)
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>
-rw-r--r--glx/glxcmds.c23
1 files changed, 8 insertions, 15 deletions
diff --git a/glx/glxcmds.c b/glx/glxcmds.c
index 9426fc154..b817e5a37 100644
--- a/glx/glxcmds.c
+++ b/glx/glxcmds.c
@@ -1687,15 +1687,14 @@ DoQueryContext(__GLXclientState * cl, GLXContextID gcId)
ClientPtr client = cl->client;
__GLXcontext *ctx;
xGLXQueryContextInfoEXTReply reply;
- int nProps;
- int *sendBuf, *pSendBuf;
+ int nProps = 3;
+ int sendBuf[nProps * 2];
int nReplyBytes;
int err;
if (!validGlxContext(cl->client, gcId, DixReadAccess, &ctx, &err))
return err;
- nProps = 3;
reply = (xGLXQueryContextInfoEXTReply) {
.type = X_Reply,
.sequenceNumber = client->sequence,
@@ -1704,17 +1703,12 @@ DoQueryContext(__GLXclientState * cl, GLXContextID gcId)
};
nReplyBytes = reply.length << 2;
- sendBuf = (int *) malloc((size_t) nReplyBytes);
- if (sendBuf == NULL) {
- return __glXError(GLXBadContext); /* XXX: Is this correct? */
- }
- pSendBuf = sendBuf;
- *pSendBuf++ = GLX_SHARE_CONTEXT_EXT;
- *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);
+ sendBuf[0] = GLX_SHARE_CONTEXT_EXT;
+ sendBuf[1] = (int) (ctx->share_id);
+ sendBuf[2] = GLX_VISUAL_ID_EXT;
+ sendBuf[3] = (int) (ctx->config->visualID);
+ sendBuf[4] = GLX_SCREEN_EXT;
+ sendBuf[5] = (int) (ctx->pGlxScreen->pScreen->myNum);
if (client->swapped) {
__glXSwapQueryContextInfoEXTReply(client, &reply, sendBuf);
@@ -1723,7 +1717,6 @@ DoQueryContext(__GLXclientState * cl, GLXContextID gcId)
WriteToClient(client, sz_xGLXQueryContextInfoEXTReply, &reply);
WriteToClient(client, nReplyBytes, sendBuf);
}
- free((char *) sendBuf);
return Success;
}