diff options
author | Paulo Zanoni <paulo.r.zanoni@intel.com> | 2011-10-29 18:33:24 -0200 |
---|---|---|
committer | Paulo Zanoni <paulo.r.zanoni@intel.com> | 2011-11-24 17:40:01 -0200 |
commit | 0ae087e13192d9b498db782be5ba49ca91a81547 (patch) | |
tree | 5416a4d842254d23e2633000e0347df166ef580a /glx/glxdriswrast.c | |
parent | d26fae246d7c451b4d5ffe24fdb959d4bd00b107 (diff) |
glx: don't leak driConfigs
For dri, dri2 and driswrast.
12,968 (584 direct, 12,384 indirect) bytes in 1 blocks are definitely lost in loss record 569 of 570
at 0x4C2779D: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
by 0x7821E3B: driConcatConfigs (utils.c:560)
by 0x7827CF2: dri_fill_in_modes (dri_screen.c:224)
by 0x782831E: dri_init_screen_helper (dri_screen.c:405)
by 0x7826C03: drisw_init_screen (drisw.c:266)
by 0x782225F: driCreateNewScreen (drisw_util.c:69)
by 0x4826E2: __glXDRIscreenProbe (glxdriswrast.c:451)
by 0x4812FA: GlxExtensionInit (glxext.c:327)
by 0x41FB14: InitExtensions (miinitext.c:471)
by 0x568622: main (main.c:208)
Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
Diffstat (limited to 'glx/glxdriswrast.c')
-rw-r--r-- | glx/glxdriswrast.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/glx/glxdriswrast.c b/glx/glxdriswrast.c index ed142c167..d064a0536 100644 --- a/glx/glxdriswrast.c +++ b/glx/glxdriswrast.c @@ -74,6 +74,7 @@ struct __GLXDRIscreen { const __DRIswrastExtension *swrast; const __DRIcopySubBufferExtension *copySubBuffer; const __DRItexBufferExtension *texBuffer; + const __DRIconfig **driConfigs; }; struct __GLXDRIcontext { @@ -240,6 +241,8 @@ static __GLXtextureFromPixmap __glXDRItextureFromPixmap = { static void __glXDRIscreenDestroy(__GLXscreen *baseScreen) { + int i; + __GLXDRIscreen *screen = (__GLXDRIscreen *) baseScreen; (*screen->core->destroyScreen)(screen->driScreen); @@ -248,6 +251,12 @@ __glXDRIscreenDestroy(__GLXscreen *baseScreen) __glXScreenDestroy(baseScreen); + if (screen->driConfigs) { + for (i = 0; screen->driConfigs[i] != NULL; i++) + free((__DRIconfig **)screen->driConfigs[i]); + free(screen->driConfigs); + } + free(screen); } @@ -426,7 +435,6 @@ __glXDRIscreenProbe(ScreenPtr pScreen) { const char *driverName = "swrast"; __GLXDRIscreen *screen; - const __DRIconfig **driConfigs; screen = calloc(1, sizeof *screen); if (screen == NULL) @@ -450,7 +458,7 @@ __glXDRIscreenProbe(ScreenPtr pScreen) screen->driScreen = (*screen->swrast->createNewScreen)(pScreen->myNum, loader_extensions, - &driConfigs, + &screen->driConfigs, screen); if (screen->driScreen == NULL) { @@ -461,7 +469,7 @@ __glXDRIscreenProbe(ScreenPtr pScreen) initializeExtensions(screen); - screen->base.fbconfigs = glxConvertConfigs(screen->core, driConfigs, + screen->base.fbconfigs = glxConvertConfigs(screen->core, screen->driConfigs, GLX_WINDOW_BIT | GLX_PIXMAP_BIT | GLX_PBUFFER_BIT); |