summaryrefslogtreecommitdiff
path: root/xfixes/cursor.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 /xfixes/cursor.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 'xfixes/cursor.c')
-rw-r--r--xfixes/cursor.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/xfixes/cursor.c b/xfixes/cursor.c
index 79530f902..402456db0 100644
--- a/xfixes/cursor.c
+++ b/xfixes/cursor.c
@@ -380,7 +380,8 @@ ProcXFixesGetCursorImage(ClientPtr client)
width = pCursor->bits->width;
height = pCursor->bits->height;
npixels = width * height;
- rep = malloc(sizeof(xXFixesGetCursorImageReply) + npixels * sizeof(CARD32));
+ rep = calloc(sizeof(xXFixesGetCursorImageReply) + npixels * sizeof(CARD32),
+ 1);
if (!rep)
return BadAlloc;
@@ -529,8 +530,8 @@ ProcXFixesGetCursorImageAndName(ClientPtr client)
name = pCursor->name ? NameForAtom(pCursor->name) : "";
nbytes = strlen(name);
nbytesRound = pad_to_int32(nbytes);
- rep = malloc(sizeof(xXFixesGetCursorImageAndNameReply) +
- npixels * sizeof(CARD32) + nbytesRound);
+ rep = calloc(sizeof(xXFixesGetCursorImageAndNameReply) +
+ npixels * sizeof(CARD32) + nbytesRound, 1);
if (!rep)
return BadAlloc;