Commit 8a62e265 authored by Alan Coopersmith's avatar Alan Coopersmith 🛫

Convert src/XKB to use reallocarray()

Signed-off-by: Alan Coopersmith's avatarAlan Coopersmith <alan.coopersmith@oracle.com>
parent 6d1dc1f6
......@@ -261,7 +261,7 @@ _XkbReadKeyActions(XkbReadBufferPtr buf, XkbDescPtr info, xkbGetMapReply *rep)
if (nKeyActs < sizeof numDescBuf)
numDesc = numDescBuf;
else
numDesc = Xmalloc(nKeyActs * sizeof(CARD8));
numDesc = Xmallocarray(nKeyActs, sizeof(CARD8));
if (!_XkbCopyFromReadBuffer(buf, (char *) numDesc, nKeyActs)) {
ret = BadLength;
......
......@@ -29,6 +29,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include <X11/Xutil.h>
#include <X11/XKBlib.h>
#include "reallocarray.h"
#define XkbMapPending (1<<0)
#define XkbXlibNewKeyboard (1<<1)
......@@ -120,7 +121,7 @@ typedef struct _XkbReadBuffer {
#define _XkbTypedAlloc(t) ((t *)Xmalloc(sizeof(t)))
#define _XkbTypedCalloc(n,t) ((t *)Xcalloc((n),sizeof(t)))
#define _XkbTypedRealloc(o,n,t) \
((o) ? (t *)Xrealloc((o), (n)*sizeof(t)) : _XkbTypedCalloc(n,t))
((o) ? (t *)Xreallocarray((o), (n), sizeof(t)) : _XkbTypedCalloc(n,t))
#define _XkbClearElems(a,f,l,t) bzero(&(a)[f], ((l)-(f)+1) * sizeof(t))
#define _XkbFree(p) Xfree(p)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment