[PATCH xf86-video-amdgpu 2/6] Fix flip event data leak if calloc or drmModeAddFB fails

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Michel Dänzer <michel.daenzer@xxxxxxx>

(Ported from radeon commit 481394e3c9f9f7d88bb66fe9ae8834c87952a8ab)

Signed-off-by: Michel Dänzer <michel.daenzer at amd.com>
---
 src/amdgpu_dri2.c     | 4 ++--
 src/drmmode_display.c | 4 +++-
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/amdgpu_dri2.c b/src/amdgpu_dri2.c
index ede6c0e0..a83d2177 100644
--- a/src/amdgpu_dri2.c
+++ b/src/amdgpu_dri2.c
@@ -465,9 +465,9 @@ xf86CrtcPtr amdgpu_dri2_drawable_crtc(DrawablePtr pDraw, Bool consider_disabled)
 static void
 amdgpu_dri2_flip_event_abort(xf86CrtcPtr crtc, void *event_data)
 {
-	AMDGPUInfoPtr info = AMDGPUPTR(crtc->scrn);
+	if (crtc)
+		AMDGPUPTR(crtc->scrn)->drmmode.dri2_flipping = FALSE;
 
-	info->drmmode.dri2_flipping = FALSE;
 	free(event_data);
 }
 
diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 67dd61b6..bc7b9c33 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -2688,8 +2688,10 @@ error:
 		amdgpu_drm_abort_entry(drm_queue_seq);
 	else if (crtc)
 		drmmode_flip_abort(crtc, flipdata);
-	else if (flipdata && flipdata->flip_count <= 1)
+	else {
+		abort(NULL, data);
 		free(flipdata);
+	}
 
 	xf86DrvMsg(scrn->scrnIndex, X_WARNING, "Page flip failed: %s\n",
 		   strerror(errno));
-- 
2.11.0



[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux