On 20-02-19 14:05, Henri Verbeet wrote:
On Wed, 20 Feb 2019 at 16:12, Sven Baars sven.wine@gmail.com wrote:
This fixes a NULL pointer dereference in device_init found by Coverity.
I don't think so.
Hi Henri,
In device_init is says
device->adapter = wined3d->adapter_count ? adapter : NULL;
meaning that device->adapter can be NULL if adapter_count can be 0. However, then I would actually expect the first line of device_init, which is
struct wined3d_adapter *adapter = &wined3d->adapters[adapter_idx];
also to fail. I found that in wined3d_init it says that
wined3d->adapter_count = 1;
and I don't think this is updated anywhere, so then maybe one could assume it is always 1, but then why does it say
device->adapter = wined3d->adapter_count ? adapter : NULL;
in the first place? Or is this part of some cleanup that still has to be done?
Best, Sven