Bug 16509

Summary: Leak in xf86XVDestroyWindow
Product: xorg Reporter: Ben Gamari <bgamari>
Component: Server/GeneralAssignee: Xorg Project Team <xorg-team>
Status: RESOLVED FIXED QA Contact: Xorg Project Team <xorg-team>
Severity: normal    
Priority: medium CC: peter.hutterer
Version: git   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:
Bug Depends on:    
Bug Blocks: 23613    
Attachments:
Description Flags
Potential Fix
none
Potential Fix (try 2) none

Description Ben Gamari 2008-06-24 20:05:33 UTC
Valgrind believes that xserver leaks in xf86XVDestroyWindow. 

==3846== 1,453,888 bytes in 534 blocks are indirectly lost in loss record 129 of 145
==3846==    at 0x4A0867E: malloc (vg_replace_malloc.c:207)
==3846==    by 0x4F6715: Xalloc (utils.c:1303)
==3846==    by 0x4F6A55: Xcalloc (utils.c:1344)
==3846==    by 0x43464F: dixAllocatePrivate (privates.c:109)
==3846==    by 0x43478C: dixLookupPrivate (privates.c:140)
==3846==    by 0x47A682: xf86XVDestroyWindow (xf86xv.c:1009)
==3846==    by 0x5043049: DbeDestroyWindow (dbe.c:1568)
==3846==    by 0x5021BB: compDestroyWindow (compwindow.c:640)
==3846==    by 0x43C52C: FreeWindowResources (window.c:889)
==3846==    by 0x43C64A: DeleteWindow (window.c:931)
==3846==    by 0x43622A: FreeClientResources (resource.c:807)
==3846==    by 0x448D4F: CloseDownClient (dispatch.c:3453)
Comment 1 Ben Gamari 2008-06-24 20:06:51 UTC
It seems like this is quite similar to Bug #16508. Should FreeWindowResources() be freeing the privates? It doesn't appear that it is at the moment.
Comment 2 Eamon Walsh 2008-06-26 11:31:21 UTC
I think I found the cause of this.  Please try the attached patch and let me know if it solves the problem.

The privates are freed in DeleteWindow() which calls FreeWindowResources().  However CrushTree() apparently also frees windows.
Comment 3 Eamon Walsh 2008-06-26 11:32:13 UTC
Created attachment 17398 [details] [review]
Potential Fix
Comment 4 Eamon Walsh 2008-06-26 11:37:31 UTC
Created attachment 17399 [details] [review]
Potential Fix (try 2)

Whoops, I mean this patch.
Comment 5 Ben Gamari 2009-04-17 07:50:28 UTC
*** Bug 16508 has been marked as a duplicate of this bug. ***
Comment 6 Ben Gamari 2009-04-17 07:51:00 UTC
Can someone please apply this?
Comment 7 Daniel Stone 2009-09-07 20:04:09 UTC
(In reply to comment #6)
> Can someone please apply this?

so the patch works for you? if so, then eamon can apply it if he's happy with it.
Comment 8 Peter Hutterer 2009-09-20 17:43:29 UTC
Was pushed as 7ddfb2f1587da3ec1cd27ae270e42700adf4f560 last year.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.