REVERT: glx: don't leak fbconfigs
Jeremy Huddleston
jeremyhu at apple.com
Sun Jan 15 02:26:23 PST 2012
We should revert this commit (d26fae246d7c451b4d5ffe24fdb959d4bd00b107). This is not the correct patch, and I'm sorry for not catching it sooner. It had my r-b, but it faded from memory.
This patch free()s memory in __glXScreenDestroy which was allocated in glxdricommon (which isn't in every DDX). That breaks abstraction and causes a crash when XQuartz quits, because it results in freeing a pointer that was never allocated.
I believe the correct fix is to do this cleanup in __glXDRIscreenDestroy.
On Oct 29, 2011, at 2:08 PM, przanoni at gmail.com wrote:
> From: Paulo Zanoni <paulo.r.zanoni at intel.com>
>
> 29,952 (208 direct, 29,744 indirect) bytes in 1 blocks are definitely lost in loss record 573 of 573
> at 0x4C2779D: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
> by 0x4829BC: createModeFromConfig (glxdricommon.c:131)
> by 0x482C09: glxConvertConfigs (glxdricommon.c:185)
> by 0x482788: __glXDRIscreenProbe (glxdriswrast.c:468)
> by 0x4812FA: GlxExtensionInit (glxext.c:327)
> by 0x41FB14: InitExtensions (miinitext.c:471)
> by 0x568636: main (main.c:208)
>
> Signed-off-by: Paulo Zanoni <paulo.r.zanoni at intel.com>
> ---
> glx/glxscreens.c | 9 +++++++++
> 1 files changed, 9 insertions(+), 0 deletions(-)
>
> diff --git a/glx/glxscreens.c b/glx/glxscreens.c
> index ebb9747..928cf0c 100644
> --- a/glx/glxscreens.c
> +++ b/glx/glxscreens.c
> @@ -419,6 +419,15 @@ void __glXScreenInit(__GLXscreen *pGlxScreen, ScreenPtr pScreen)
>
> void __glXScreenDestroy(__GLXscreen *screen)
> {
> + __GLXconfig *head, *next;
> +
> + head = screen->fbconfigs;
> + while (head) {
> + next = head->next;
> + free(head);
> + head = next;
> + }
> +
> free(screen->GLXvendor);
> free(screen->GLXextensions);
> free(screen->GLextensions);
> --
> 1.7.7
>
> _______________________________________________
> xorg-devel at lists.x.org: X.Org development
> Archives: http://lists.x.org/archives/xorg-devel
> Info: http://lists.x.org/mailman/listinfo/xorg-devel
>
More information about the xorg-devel
mailing list