summaryrefslogtreecommitdiff
path: root/src/radeon_dri2.c
diff options
context:
space:
mode:
authorMichel Dänzer <daenzer@vmware.com>2010-10-27 11:29:12 +0200
committerMichel Dänzer <michel@daenzer.net>2010-10-27 11:34:40 +0200
commitf815e9c3c61b1ed73e7dd9383587efcdd8dfc07f (patch)
tree96e90eae7a00702dca74602423c7cfd74fbbe2c7 /src/radeon_dri2.c
parentdf92245e1fd0ead2581b675cd96ac8bcc8cb65d7 (diff)
Don't try to delete DRI2 event list entries that were never added. (Bug #31086)
Fixes https://bugs.freedesktop.org/show_bug.cgi?id=31086 .
Diffstat (limited to 'src/radeon_dri2.c')
-rw-r--r--src/radeon_dri2.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/radeon_dri2.c b/src/radeon_dri2.c
index 2668812f..1428216a 100644
--- a/src/radeon_dri2.c
+++ b/src/radeon_dri2.c
@@ -704,6 +704,8 @@ static int radeon_dri2_schedule_wait_msc(ClientPtr client, DrawablePtr draw,
if (ListAddDRI2ClientEvents(client, &wait_info->link)) {
xf86DrvMsg(scrn->scrnIndex, X_WARNING,
"add events to client private failed.\n");
+ free(wait_info);
+ wait_info = NULL;
goto out_complete;
}
@@ -825,7 +827,7 @@ static int radeon_dri2_schedule_swap(ClientPtr client, DrawablePtr draw,
RADEONInfoPtr info = RADEONPTR(scrn);
drmVBlank vbl;
int ret, crtc= radeon_dri2_drawable_crtc(draw), flip = 0;
- DRI2FrameEventPtr swap_info;
+ DRI2FrameEventPtr swap_info = NULL;
enum DRI2FrameEventType swap_type = DRI2_SWAP;
CARD64 current_msc;
BoxRec box;
@@ -837,8 +839,6 @@ static int radeon_dri2_schedule_swap(ClientPtr client, DrawablePtr draw,
divisor &= 0xffffffff;
remainder &= 0xffffffff;
- swap_info = calloc(1, sizeof(DRI2FrameEventRec));
-
/* radeon_dri2_frame_event_handler will get called some unknown time in the
* future with these buffers. Take a reference to ensure that they won't
* get destroyed before then.
@@ -847,7 +847,11 @@ static int radeon_dri2_schedule_swap(ClientPtr client, DrawablePtr draw,
radeon_dri2_ref_buffer(back);
/* Drawable not displayed... just complete the swap */
- if (crtc == -1 || !swap_info)
+ if (crtc == -1)
+ goto blit_fallback;
+
+ swap_info = calloc(1, sizeof(DRI2FrameEventRec));
+ if (!swap_info)
goto blit_fallback;
swap_info->drawable_id = draw->id;
@@ -860,6 +864,8 @@ static int radeon_dri2_schedule_swap(ClientPtr client, DrawablePtr draw,
if (ListAddDRI2ClientEvents(client, &swap_info->link)) {
xf86DrvMsg(scrn->scrnIndex, X_WARNING,
"add events to client private failed.\n");
+ free(swap_info);
+ swap_info = NULL;
goto blit_fallback;
}