mirror of
https://gitlab.freedesktop.org/xorg/xserver.git
synced 2026-05-05 01:48:02 +02:00
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
1 changed files with 5 additions and 6 deletions
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…
Add table
Reference in a new issue