dix: don't overwrite proximity/focus classes
InitPointerClassDeviceStruct/InitKeyboardDeviceStruct allocate a proximity/focus class, respectively. If a driver calls InitFocusClassDeviceStruct or InitProximityClassDeviceStruct beforehand, the previously allocated class is overwritten, leaking the memory. Neither takes a parameter other than the device, so we can simply skip initialising it if we already have one. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Dave Airlie <airlied@redhat.com>
This commit is contained in:
		
							parent
							
								
									34b0d07ebf
								
							
						
					
					
						commit
						8a88b0ab52
					
				| 
						 | 
					@ -1367,7 +1367,7 @@ InitValuatorClassDeviceStruct(DeviceIntPtr dev, int numAxes, Atom *labels,
 | 
				
			||||||
    valc->numMotionEvents = numMotionEvents;
 | 
					    valc->numMotionEvents = numMotionEvents;
 | 
				
			||||||
    valc->motionHintWindow = NullWindow;
 | 
					    valc->motionHintWindow = NullWindow;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (mode & OutOfProximity)
 | 
					    if ((mode & OutOfProximity) && !dev->proximity)
 | 
				
			||||||
        InitProximityClassDeviceStruct(dev);
 | 
					        InitProximityClassDeviceStruct(dev);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    dev->valuator = valc;
 | 
					    dev->valuator = valc;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -589,6 +589,7 @@ InitKeyboardDeviceStruct(DeviceIntPtr dev, XkbRMLVOSet * rmlvo,
 | 
				
			||||||
    XkbUpdateActions(dev, xkb->min_key_code, XkbNumKeys(xkb), &changes,
 | 
					    XkbUpdateActions(dev, xkb->min_key_code, XkbNumKeys(xkb), &changes,
 | 
				
			||||||
                     &check, &cause);
 | 
					                     &check, &cause);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if (!dev->focus)
 | 
				
			||||||
        InitFocusClassDeviceStruct(dev);
 | 
					        InitFocusClassDeviceStruct(dev);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    xkbi->kbdProc = ctrl_func;
 | 
					    xkbi->kbdProc = ctrl_func;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue