The memory of the platform driver data should be freed
before it was set to NULL.
This seems backwards to me. Currently the reference is invalidated before
the object, which seems to make more sense.
As there is no locking here it really makes no difference anyway