xfree86: Fix null pointer dereference

Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=93675
Signed-off-by: Kyle Guinn <elyk03@gmail.com>
[hdegoede@redhat.com: Simplify by adding 2 if conds together with &&]
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
This commit is contained in:
Kyle Guinn 2016-09-23 15:03:34 +03:00 committed by Adam Jackson
parent 127e0569ca
commit 44968da376

View File

@ -614,7 +614,7 @@ xf86CreateI2CDevRec(void)
void
xf86DestroyI2CDevRec(I2CDevPtr d, Bool unalloc)
{
if (d) {
if (d && d->pI2CBus) {
I2CDevPtr *p;
/* Remove this from the list of active I2C devices. */
@ -628,10 +628,10 @@ xf86DestroyI2CDevRec(I2CDevPtr d, Bool unalloc)
xf86DrvMsg(d->pI2CBus->scrnIndex, X_INFO,
"I2C device \"%s:%s\" removed.\n",
d->pI2CBus->BusName, d->DevName);
if (unalloc)
free(d);
}
if (unalloc)
free(d);
}
/* I2C transmissions are related to an I2CDevRec you must link to a