Check for calloc() failure in add_master()

Reported-by: Ilja Van Sprundel <ivansprundel@ioactive.com>
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit 9fc19168e7)
This commit is contained in:
Alan Coopersmith 2014-01-24 23:42:49 -08:00 committed by Peter Hutterer
parent f11c5938d7
commit 157cc02fc1

View file

@ -143,6 +143,10 @@ add_master(ClientPtr client, xXIAddMasterInfo * c, int flags[MAXDEVICES])
int rc;
name = calloc(c->name_len + 1, sizeof(char));
if (name == NULL) {
rc = BadAlloc;
goto unwind;
}
strncpy(name, (char *) &c[1], c->name_len);
rc = AllocDevicePair(client, name, &ptr, &keybd,