Bug 17659

Summary: driver_configs never deallocated
Product: Mesa Reporter: Caolán McNamara <caolanm>
Component: GLXAssignee: mesa-dev
Status: RESOLVED MOVED QA Contact:
Severity: normal    
Priority: medium    
Version: unspecified   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments: half-hearted demo patch which makes valgrind shutup

Description Caolán McNamara 2008-09-19 05:08:24 UTC
Created attachment 19010 [details] [review]
half-hearted demo patch which makes valgrind shutup

in src/glx/x11/drisw_glx.c 

const __DRIconfig **driver_configs;

psc->swrast->createNewScreen(screen,
    loader_extensions, &driver_configs, psc);

allocates space for the driver_configs which never get released afaics

valgrind gives...

==25950== 7,304 (392 direct, 6,912 indirect) bytes in 1 blocks are definitely lost in loss record 201 of 257
==25950==    at 0x4A0739E: malloc (vg_replace_malloc.c:207)
==25950==    by 0xC0A17BD: driConcatConfigs (utils.c:749)
==25950==    by 0xC0A2517: driCreateNewScreen (swrast.c:218)
==25950==    by 0xBC52B0B: driCreateScreen (drisw_glx.c:385)
==25950==    by 0xBC39656: __glXInitialize (glxext.c:618)
==25950==    by 0xBC35BF1: GetGLXPrivScreenConfig (glxcmds.c:184)
==25950==    by 0xBC3670A: glXGetConfig (glxcmds.c:906)
Comment 1 George Sapountzis 2010-03-27 05:49:45 UTC
(In reply to comment #0)
> Created an attachment (id=19010) [details]
> half-hearted demo patch which makes valgrind shutup
> 
> in src/glx/x11/drisw_glx.c 
> 
> const __DRIconfig **driver_configs;
> 
> psc->swrast->createNewScreen(screen,
>     loader_extensions, &driver_configs, psc);
> 
> allocates space for the driver_configs which never get released afaics
> 

You are right that they are not freed. The problem exists for actual DRI drivers also and for other loaders (xserver/glx ...).

So unless the configs are used by the loader after screen destruction time, I think that they should be freed by the common dri code under src/mesa/drivers/dri/common in the .DestroyScreen hook.
Comment 2 Kristof Ralovich 2010-03-29 12:54:52 UTC
(In reply to comment #1)
> (In reply to comment #0)
> > Created an attachment (id=19010) [details] [details]
> > half-hearted demo patch which makes valgrind shutup
> > 
> > in src/glx/x11/drisw_glx.c 
> > 
> > const __DRIconfig **driver_configs;
> > 
> > psc->swrast->createNewScreen(screen,
> >     loader_extensions, &driver_configs, psc);
> > 
> > allocates space for the driver_configs which never get released afaics
> > 
> 
> You are right that they are not freed. The problem exists for actual DRI
> drivers also and for other loaders (xserver/glx ...).
> 
> So unless the configs are used by the loader after screen destruction time, I
> think that they should be freed by the common dri code under
> src/mesa/drivers/dri/common in the .DestroyScreen hook.
> 

I don't have the time to look into the code right now, but I had this patch merged once http://cgit.freedesktop.org/mesa/mesa/commit/?id=fa5b0364f90be19bb0e1915f1eea691d06fb8929
Comment 5 GitLab Migration User 2019-09-18 17:11:11 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/mesa/mesa/issues/54.

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.