[PATCH 13/19] glx: realloc style fix in RenderLarge

Adam Jackson ajax at redhat.com
Wed Aug 21 14:25:18 PDT 2013


Signed-off-by: Adam Jackson <ajax at redhat.com>
---
 glx/glxcmds.c | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/glx/glxcmds.c b/glx/glxcmds.c
index b817e5a..9deadb7 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);
-- 
1.8.3.1



More information about the xorg-devel mailing list