summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2014-12-19 08:37:07 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2014-12-19 08:37:07 +0000
commit6f99bbe67e6e70d5b24611c7afa0dffc5632aaab (patch)
tree973ac81c022983a89fe851911f73a10cdbdf32a1 /src
parentfdd7508e53043f82f9cf422fc968c6574334a667 (diff)
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>
Diffstat (limited to 'src')
-rw-r--r--src/sna/sna_dri2.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/sna/sna_dri2.c b/src/sna/sna_dri2.c
index 8f8baefb..bd5e26d7 100644
--- a/src/sna/sna_dri2.c
+++ b/src/sna/sna_dri2.c
@@ -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