Free pAMDGPUEnt memory in AMDGPUFreeRec
PATCH 1/4 Free pAMDGPUEnt memory in AMDGPUFreeRec
From: Michel Dänzer <[email protected]>
We were freeing it earlier but then still trying to access it in AMDGPUFreeRec.
--- src/amdgpu_kms.c | 2 ++ src/amdgpu_probe.c | 8 ++------ 2 files changed, 4 insertions(+), 6 deletions(-)
src/amdgpu_kms.c +2 -0
@@ -138,6 +138,8 @@ static void AMDGPUFreeRec(ScrnInfoPtr pScrn)if (!pAMDGPUEnt->fd_ref) {amdgpu_device_deinitialize (pAMDGPUEnt->pDev);amdgpu_kernel_close_fd (pAMDGPUEnt); +free (pPriv->ptr); + pPriv->ptr =NULL ; } }
src/amdgpu_probe.c +2 -6
@@ -227,7 +227,7 @@ static Bool amdgpu_get_scrninfo(int entity_num, struct pci_device *pci_dev) pAMDGPUEnt = pPriv->ptr;if (!amdgpu_open_drm_master (pScrn, pAMDGPUEnt, busid)) - goto error_fd; + goto error; pAMDGPUEnt->fd_ref =1 ;
@@ -255,8 +255,6 @@ static Bool amdgpu_get_scrninfo(int entity_num, struct pci_device *pci_dev) error_amdgpu:amdgpu_kernel_close_fd (pAMDGPUEnt); -error_fd: -free (pPriv->ptr); error:free (busid);return FALSE;
@@ -352,7 +350,7 @@ amdgpu_platform_probe(DriverPtr pDriver, pAMDGPUEnt->platform_dev = dev; pAMDGPUEnt->fd =amdgpu_kernel_open_fd (pScrn, busid, dev);if (pAMDGPUEnt->fd <0 ) - goto error_fd; + goto error; pAMDGPUEnt->fd_ref =1 ;
@@ -380,8 +378,6 @@ amdgpu_platform_probe(DriverPtr pDriver, error_amdgpu:amdgpu_kernel_close_fd (pAMDGPUEnt); -error_fd: -free (pPriv->ptr); error:free (busid);return FALSE;
Signature · 6 lines
2.14.2 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 20171019160536.6569-1-michel-otUistvHUpPR7s880joybQ@public.gmane.org
PATCH 2/4 Free memory returned by xf86GetEntityInfo
From: Michel Dänzer <[email protected]>
We were leaking it.
--- src/amdgpu_kms.c | 19 +++++++++++++------ src/amdgpu_probe.c | 6 ++++-- 2 files changed, 17 insertions(+), 8 deletions(-)
src/amdgpu_kms.c +13 -6
@@ -116,16 +116,24 @@ static void AMDGPUFreeRec(ScrnInfoPtr pScrn)DevUnion *pPriv;AMDGPUEntPtr pAMDGPUEnt;AMDGPUInfoPtr info; +EntityInfoPtr pEnt;if (!pScrn)return ; info =AMDGPUPTR (pScrn); -if (info && info->fbcon_pixmap) - pScrn->pScreen->DestroyPixmap (info->fbcon_pixmap); +if (info) { +if (info->fbcon_pixmap) + pScrn->pScreen->DestroyPixmap (info->fbcon_pixmap); - pPriv =xf86GetEntityPrivate (xf86GetEntityInfo (pScrn->entityList[pScrn->numEntities -1 ])->index, - gAMDGPUEntityIndex); + pEnt = info->pEnt; +free (pScrn->driverPrivate); + pScrn->driverPrivate =NULL ; + }else { + pEnt =xf86GetEntityInfo (pScrn->entityList[pScrn->numEntities -1 ]); + } + + pPriv =xf86GetEntityPrivate (pEnt->index, gAMDGPUEntityIndex); pAMDGPUEnt = pPriv->ptr;if (pAMDGPUEnt->fd >0 ) {DevUnion *pPriv;
@@ -143,8 +151,7 @@ static void AMDGPUFreeRec(ScrnInfoPtr pScrn) } } -free (pScrn->driverPrivate); - pScrn->driverPrivate =NULL ; +free (pEnt); } static void *amdgpuShadowWindow(ScreenPtr screen, CARD32 row, CARD32 offset,
src/amdgpu_probe.c +4 -2
@@ -177,7 +177,7 @@ static Bool amdgpu_get_scrninfo(int entity_num, struct pci_device *pci_dev) {ScrnInfoPtr pScrn =NULL ;char *busid; -EntityInfoPtr pEnt; +EntityInfoPtr pEnt =NULL ;DevUnion *pPriv;AMDGPUEntPtr pAMDGPUEnt;
@@ -256,6 +256,7 @@ static Bool amdgpu_get_scrninfo(int entity_num, struct pci_device *pci_dev) error_amdgpu:amdgpu_kernel_close_fd (pAMDGPUEnt); error: +free (pEnt);free (busid);return FALSE; }
@@ -294,7 +295,7 @@ amdgpu_platform_probe(DriverPtr pDriver,ScrnInfoPtr pScrn;int scr_flags =0 ;char *busid; -EntityInfoPtr pEnt; +EntityInfoPtr pEnt =NULL ;DevUnion *pPriv;AMDGPUEntPtr pAMDGPUEnt;
@@ -379,6 +380,7 @@ amdgpu_platform_probe(DriverPtr pDriver, error_amdgpu:amdgpu_kernel_close_fd (pAMDGPUEnt); error: +free (pEnt);free (busid);return FALSE; }
Signature · 6 lines
2.14.2 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 3/4 Call TimerFree for timer created in LeaveVT
In reply to a message not in the archiveFrom: Michel Dänzer <[email protected]>
We were leaking the memory allocated by TimerSet.
--- src/amdgpu_kms.c | 1 + 1 file changed, 1 insertion(+)
src/amdgpu_kms.c +1 -0
@@ -1624,6 +1624,7 @@ CARD32 cleanup_black_fb(OsTimerPtr timer, CARD32 now, pointer data)drmmode_fb_reference (pAMDGPUEnt->fd, &drmmode_crtc->fb,NULL ); } +TimerFree (timer);return 0 ; }
Signature · 6 lines
2.14.2 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 4/4 Always call drmModeFreeProperty after drmModeGetProperty
In reply to a message not in the archiveFrom: Michel Dänzer <[email protected]>
We were not doing so in all cases, leaking memory allocated by the latter.
--- src/drmmode_display.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
src/drmmode_display.c +2 -2
@@ -1891,8 +1891,8 @@ drmmode_output_init(ScrnInfoPtr pScrn, drmmode_ptr drmmode, drmModeResPtr mode_rdrmModeFreeProperty (props);break ; } -drmModeFreeProperty (props); } +drmModeFreeProperty (props); } kencoders =calloc (sizeof (drmModeEncoderPtr), koutput->count_encoders);
@@ -1986,8 +1986,8 @@ drmmode_output_init(ScrnInfoPtr pScrn, drmmode_ptr drmmode, drmModeResPtr mode_rdrmModeFreeProperty (props);break ; } -drmModeFreeProperty (props); } +drmModeFreeProperty (props); }if (dynamic) {
Signature · 6 lines
2.14.2 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 20171019160536.6569-4-michel-otUistvHUpPR7s880joybQ@public.gmane.org
Deucher, Alexander
Reviewed-by Alex DeucherRE: [PATCH xf86-video-amdgpu 4/4] Always call drmModeFreeProperty after drmModeGetProperty
Quoted 8 lines
-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of Michel Dänzer
Sent: Thursday, October 19, 2017 12:06 PM
To: [email protected]
Subject: [PATCH xf86-video-amdgpu 4/4] Always call drmModeFreeProperty after drmModeGetProperty
Quoted 6 lines
From: Michel Dänzer <[email protected]>
We were not doing so in all cases, leaking memory allocated by the latter.
Signed-off-by Michel Dänzer <[email protected]>
Series is:
Quoted 34 lines
--- src/drmmode_display.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)src/drmmode_display.c +0
-0@@ -1891,8 +1891,8 @@ drmmode_output_init(ScrnInfoPtr pScrn,
drmmode_ptrdrmmode, drmModeResPtrmode_rsrc/drmmode_display.c +1
-1drmModeFreeProperty (props);break ; } -drmModeFreeProperty (props); } +drmModeFreeProperty (props); } kencoders = calloc(sizeof(drmModeEncoderPtr), koutput-Quoted 1 line
count_encoders);src/drmmode_display.c +0
-0@@ -1986,8 +1986,8 @@ drmmode_output_init(ScrnInfoPtr pScrn,
drmmode_ptrdrmmode, drmModeResPtrmode_rsrc/drmmode_display.c +1
-2drmModeFreeProperty (props);break ; } -drmModeFreeProperty (props); } +drmModeFreeProperty (props); }if (dynamic) { --2.14.2
Quoted 4 lines
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx