(!1967) dix: protect against alloc failure in ‘DeviceFocusEvent()
Fixes analyzer warning: | ../dix/enterleave.c: In function ‘DeviceFocusEvent’: | ../dix/enterleave.c:788:20: warning: dereference of possibly-NULL ‘xi2event’ [CWE-690] [-Wanalyzer-possible-null-dereference] | 788 | xi2event->type = GenericEvent; | ‘DoFocusEvents’: events 1-4 Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
		
							parent
							
								
									709e8e04b5
								
							
						
					
					
						commit
						830b37f863
					
				|  | @ -771,7 +771,6 @@ DeviceFocusEvent(DeviceIntPtr dev, int type, int mode, int detail, | |||
|                  WindowPtr pWin) | ||||
| { | ||||
|     deviceFocus event; | ||||
|     xXIFocusInEvent *xi2event; | ||||
|     int btlen, len, i; | ||||
| 
 | ||||
|     DeviceIntPtr mouse = InputDevIsFloating(dev) ? | ||||
|  | @ -783,7 +782,10 @@ DeviceFocusEvent(DeviceIntPtr dev, int type, int mode, int detail, | |||
|     btlen = bytes_to_int32(btlen); | ||||
|     len = sizeof(xXIFocusInEvent) + btlen * 4; | ||||
| 
 | ||||
|     xi2event = calloc(1, len); | ||||
|     xXIFocusInEvent *xi2event = calloc(1, len); | ||||
|     if (!xi2event) | ||||
|         return; | ||||
| 
 | ||||
|     xi2event->type = GenericEvent; | ||||
|     xi2event->extension = IReqCode; | ||||
|     xi2event->evtype = type; | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue