diff options
author | Alan Coopersmith <alan.coopersmith@oracle.com> | 2013-12-08 12:24:21 -0800 |
---|---|---|
committer | Alan Coopersmith <alan.coopersmith@oracle.com> | 2013-12-09 21:33:39 -0800 |
commit | e0715a0389874d257a39ed3399b4a512317be0da (patch) | |
tree | 16e31f6d05c057da8fc3c797a4c0b792d96a1ffb | |
parent | 78d267a0e0013d89a756cffe0e1dccb71945a0a4 (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.c | 6 |
1 files changed, 2 insertions, 4 deletions
@@ -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); |