summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2013-12-08 12:24:21 -0800
committerAlan Coopersmith <alan.coopersmith@oracle.com>2013-12-09 21:33:39 -0800
commite0715a0389874d257a39ed3399b4a512317be0da (patch)
tree16e31f6d05c057da8fc3c797a4c0b792d96a1ffb
parent78d267a0e0013d89a756cffe0e1dccb71945a0a4 (diff)
Replace malloc(size); memset(...,0,size) with calloc
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
-rw-r--r--src/dmx.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/dmx.c b/src/dmx.c
index 5ef0ed4..7e1f953 100644
--- a/src/dmx.c
+++ b/src/dmx.c
@@ -440,8 +440,7 @@ Bool DMXAddScreen(Display *dpy, const char *displayName, unsigned int mask,
req->length += _DMXDumpScreenAttributes(dpy, mask, attr);
if (length) {
- char *buffer = Xmalloc(paddedLength);
- memset(buffer, 0, paddedLength);
+ char *buffer = Xcalloc(paddedLength, 1);
memcpy(buffer, displayName, length);
Data32(dpy, buffer, paddedLength);
Xfree(buffer);
@@ -780,8 +779,7 @@ Bool DMXAddInput(Display *dpy, unsigned int mask, DMXInputAttributes *attr,
req->length += _DMXDumpInputAttributes(dpy, mask, attr);
if (length) {
- char *buffer = Xmalloc(paddedLength);
- memset(buffer, 0, paddedLength);
+ char *buffer = Xcalloc(paddedLength, 1);
memcpy(buffer, attr->name, paddedLength);
Data32(dpy, buffer, paddedLength);
Xfree(buffer);