summaryrefslogtreecommitdiff
path: root/glx
diff options
context:
space:
mode:
authorAdam Jackson <ajax@redhat.com>2013-07-02 10:35:19 -0400
committerAdam Jackson <ajax@redhat.com>2013-09-11 14:37:32 -0400
commitacf14c1de766c4ea206cd7ce7f25b780a589d33c (patch)
treefc7e9437c6feffbaf2da0e954a340d5dd5bd6670 /glx
parent9ebf739a6864c9ec38bf72f63ef2e3b9cd1951db (diff)
glx: realloc style fix in RenderLarge
Reviewed-by: Eric Anholt <eric@anholt.net> Signed-off-by: Adam Jackson <ajax@redhat.com>
Diffstat (limited to 'glx')
-rw-r--r--glx/glxcmds.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/glx/glxcmds.c b/glx/glxcmds.c
index b817e5a37..9deadb748 100644
--- a/glx/glxcmds.c
+++ b/glx/glxcmds.c
@@ -2176,15 +2176,12 @@ __glXDisp_RenderLarge(__GLXclientState * cl, GLbyte * pc)
** Make enough space in the buffer, then copy the entire request.
*/
if (cl->largeCmdBufSize < cmdlen) {
- if (!cl->largeCmdBuf) {
- cl->largeCmdBuf = (GLbyte *) malloc(cmdlen);
- }
- else {
- cl->largeCmdBuf = (GLbyte *) realloc(cl->largeCmdBuf, cmdlen);
- }
- if (!cl->largeCmdBuf) {
- return BadAlloc;
- }
+ GLbyte *newbuf = cl->largeCmdBuf;
+
+ if (!(newbuf = realloc(newbuf, cmdlen)))
+ return BadAlloc;
+
+ cl->largeCmdBuf = newbuf;
cl->largeCmdBufSize = cmdlen;
}
memcpy(cl->largeCmdBuf, pc, dataBytes);