summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2014-01-24 23:42:49 -0800
committerPeter Hutterer <peter.hutterer@who-t.net>2014-02-19 10:24:16 +1000
commit157cc02fc13c998bba70e1652907972015e15e8e (patch)
treef0e275cab7c358cead16503ab37d462461709a62
parentf11c5938d732af717aeebbbf3b356138f3411bb7 (diff)
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 9fc19168e7ca6308275bf8769d1ccb982f88465b)
-rw-r--r--Xi/xichangehierarchy.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/Xi/xichangehierarchy.c b/Xi/xichangehierarchy.c
index e2f4b8a0a..9e36354d1 100644
--- a/Xi/xichangehierarchy.c
+++ b/Xi/xichangehierarchy.c
@@ -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,