summaryrefslogtreecommitdiff
path: root/glx/glxcmds.c
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2012-07-09 19:12:42 -0700
committerAlan Coopersmith <alan.coopersmith@oracle.com>2012-07-09 19:58:29 -0700
commitcdf5bcd420e5bcf4a4a24a275d3133a4e16ce41e (patch)
treeebc4c13ebd7471cbfa7425c190303793ea5b7ff9 /glx/glxcmds.c
parentef0f701c9245b0373eb0c7a84dd804af4738bb29 (diff)
Use calloc to zero fill buffers being allocated for replies & events
Ensures padding bytes are zero-filled Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Keith Packard <keithp@keithp.com> Tested-by: Daniel Stone <daniel@fooishbar.org>
Diffstat (limited to 'glx/glxcmds.c')
-rw-r--r--glx/glxcmds.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/glx/glxcmds.c b/glx/glxcmds.c
index 9cb9e735b..c1c836fe9 100644
--- a/glx/glxcmds.c
+++ b/glx/glxcmds.c
@@ -2315,7 +2315,7 @@ __glXDisp_QueryExtensionsString(__GLXclientState * cl, GLbyte * pc)
reply.n = n;
/* Allocate buffer to make sure it's a multiple of 4 bytes big. */
- buf = (char *) malloc(length << 2);
+ buf = calloc(length, 4);
if (buf == NULL)
return BadAlloc;
memcpy(buf, pGlxScreen->GLXextensions, n);
@@ -2375,7 +2375,7 @@ __glXDisp_QueryServerString(__GLXclientState * cl, GLbyte * pc)
reply.length = length;
reply.n = n;
- buf = (char *) malloc(length << 2);
+ buf = calloc(length, 4);
if (buf == NULL) {
return BadAlloc;
}