diff --git a/Xi/listdev.c b/Xi/listdev.c index bf2f439a4..95f0d8103 100644 --- a/Xi/listdev.c +++ b/Xi/listdev.c @@ -363,6 +363,10 @@ ProcXListInputDevices(ClientPtr client) /* allocate space for reply */ total_length = numdevs * sizeof(xDeviceInfo) + size + namesize; devbuf = (char *) calloc(1, total_length); + if (!devbuf) { + free(skip); + return BadAlloc; + } classbuf = devbuf + (numdevs * sizeof(xDeviceInfo)); namebuf = classbuf + size; savbuf = devbuf;