(!1967) dix: make DeviceEnterLeaveEvent() anaylzer-friendly

The analyzer giving a false alarm on potential NULL-pointer deref here.
Even though that case can't happen, it's also not immediately clear
to the human reader.

To make both the analyzer as well human reader happier, reformulating
this function to by using fast-return pattern.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
Enrico Weigelt, metux IT consult 2025-05-07 13:01:20 +02:00
parent 1014867436
commit fe301f124a

View File

@ -4745,7 +4745,6 @@ DeviceEnterLeaveEvent(DeviceIntPtr mouse,
int mode, int detail, WindowPtr pWin, Window child)
{
GrabPtr grab = mouse->deviceGrab.grab;
xXIEnterEvent *event;
WindowPtr focus;
int filter;
int btlen, len, i;
@ -4759,7 +4758,10 @@ DeviceEnterLeaveEvent(DeviceIntPtr mouse,
btlen = bytes_to_int32(btlen);
len = sizeof(xXIEnterEvent) + btlen * 4;
event = calloc(1, len);
xXIEnterEvent *event = calloc(1, len);
if (!event)
return;
event->type = GenericEvent;
event->extension = IReqCode;
event->evtype = type;