diff options
author | Kyle Guinn <elyk03@gmail.com> | 2016-09-23 15:03:34 +0300 |
---|---|---|
committer | Adam Jackson <ajax@redhat.com> | 2016-09-28 14:53:39 -0400 |
commit | 44968da376c880e096225f149f78673aa4c6e5e0 (patch) | |
tree | fb43f7f6f2f8f2f4b800745ef57370dacefd7d69 /hw/xfree86 | |
parent | 127e0569ca8dbf774df8f83d4c59bbbbf2e25a20 (diff) |
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>
Diffstat (limited to 'hw/xfree86')
-rw-r--r-- | hw/xfree86/i2c/xf86i2c.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/hw/xfree86/i2c/xf86i2c.c b/hw/xfree86/i2c/xf86i2c.c index 2a8b8df22..22109cfbc 100644 --- a/hw/xfree86/i2c/xf86i2c.c +++ b/hw/xfree86/i2c/xf86i2c.c @@ -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 |