sna/dri2: Prevent NULL pointer dereference of Window private

In case we receive quick successive calls to DRI2GetBuffers on the same
Window, we need to check that the private exists before dereferencing
it.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
Chris Wilson 2014-12-19 08:37:07 +00:00
parent fdd7508e53
commit 6f99bbe67e
1 changed files with 5 additions and 1 deletions

View File

@ -234,7 +234,11 @@ dri2_chain(DrawablePtr d)
assert(priv != NULL);
return priv->chain;
}
inline static DRI2BufferPtr dri2_window_get_front(WindowPtr win) { return dri2_window(win)->front; }
inline static DRI2BufferPtr dri2_window_get_front(WindowPtr win)
{
struct dri2_window *priv = dri2_window(win);
return priv ? priv->front : NULL;
}
#else
inline static void *dri2_window_get_front(WindowPtr win) { return NULL; }
#endif