From 9fc19168e7ca6308275bf8769d1ccb982f88465b Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Fri, 24 Jan 2014 23:42:49 -0800 Subject: Check for calloc() failure in add_master() Reported-by: Ilja Van Sprundel Signed-off-by: Alan Coopersmith Reviewed-by: Peter Hutterer Signed-off-by: Peter Hutterer --- Xi/xichangehierarchy.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'Xi') 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, -- cgit v1.2.3