Handle NULL argument in evdev_free

Add check for evdev argument of evdev_free being NULL. This is valid
value and should not cause crash. In this case evdev_free does nothing

Submitted by:	Vladimir Kondratiev <wulf@cicgroup.ru>
This commit is contained in:
Oleksandr Tymoshenko 2016-09-23 18:54:08 +00:00
parent 3cdfcb51aa
commit c3f2135cfc
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=306274

View File

@ -92,7 +92,8 @@ void
evdev_free(struct evdev_dev *evdev)
{
if (evdev->ev_cdev != NULL && evdev->ev_cdev->si_drv1 != NULL)
if (evdev != NULL && evdev->ev_cdev != NULL &&
evdev->ev_cdev->si_drv1 != NULL)
evdev_unregister(evdev);
free(evdev, M_EVDEV);