If AllocGrab() fails to set up grab, don't copy to a NULL grab
If either the initial calloc or the xi2mask_new fails, grab is NULL, but if a src grab is passed in, it was always being written to by CopyGrab (and if that failed, dereferenced again in teardown). Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
parent
2ea973e12f
commit
3a113815a0
11
dix/grabs.c
11
dix/grabs.c
|
@ -199,12 +199,11 @@ AllocGrab(const GrabPtr src)
|
|||
free(grab);
|
||||
grab = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if (src && !CopyGrab(grab, src)) {
|
||||
free(grab->xi2mask);
|
||||
free(grab);
|
||||
grab = NULL;
|
||||
else if (src && !CopyGrab(grab, src)) {
|
||||
free(grab->xi2mask);
|
||||
free(grab);
|
||||
grab = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
return grab;
|
||||
|
|
Loading…
Reference in New Issue
Block a user