diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2013-09-23 21:08:13 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2013-09-23 21:12:19 +0100 |
commit | 63a81c87b1be3607243aaa0acc4cb669fee02b4b (patch) | |
tree | 5d0282e55c0947098f3e8daedb17a4d68d74b0a6 /src | |
parent | 3fd116782bb1c05a140f4783e92a8ee6a57143cd (diff) |
sna/dri: Prevent a NULL dereference in a DBG msg
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src')
-rw-r--r-- | src/sna/sna_dri.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/sna/sna_dri.c b/src/sna/sna_dri.c index 7dfa479a..56cb78f0 100644 --- a/src/sna/sna_dri.c +++ b/src/sna/sna_dri.c @@ -1468,7 +1468,6 @@ sna_dri_immediate_blit(struct sna *sna, static void sna_dri_flip_get_back(struct sna *sna, struct sna_dri_frame_event *info) { - struct dri_bo *c; struct kgem_bo *bo; uint32_t name; @@ -1489,13 +1488,15 @@ sna_dri_flip_get_back(struct sna *sna, struct sna_dri_frame_event *info) bo = NULL; if (!list_is_empty(&info->cache)) { - c = list_first_entry(&info->cache, struct dri_bo, link); - bo = c->bo; - name = c->name; - DBG(("%s: reuse cache handle=%d,name=%d\n", __FUNCTION__, - bo->handle, name)); - list_move_tail(&c->link, &info->cache); - c->bo = NULL; + struct dri_bo *c = list_first_entry(&info->cache, struct dri_bo, link); + if (c->bo) { + bo = c->bo; + name = c->name; + DBG(("%s: reuse cache handle=%d,name=%d\n", __FUNCTION__, + bo->handle, name)); + list_move_tail(&c->link, &info->cache); + c->bo = NULL; + } } if (bo == NULL) { DBG(("%s: allocating new backbuffer\n", __FUNCTION__)); |