Re: [PATCH] Fix a memory leak in X11_GL_CreateContext

Tapani Pälli <[email protected]>
Newsgroups gmane.comp.lib.sdl
Organization Intel Finland Oy, Registered Address: PL 281, 00181 Helsinki, Business Identity Code: 0357606 - 4, Domiciled in Helsinki
Message-ID <[email protected]>
On 11/01/2016 07:47 PM, Sam Lantinga wrote:
> Got it, thanks!
>
> https://hg.libsdl.org/SDL/rev/0cbc922ef093
>
> In general it's helpful to submit a bug to http://bugzilla.libsdl.org so
> that patches don't get lost on the mailing list.

No problem, I was not sure how the development workflow for SDL looks 
like. I also sent another small fix:

http://lists.libsdl.org/pipermail/sdl-libsdl.org/2016-November/100828.html

I'll make sure to open up bugs for any new upcoming patches.


> Cheers,
>
> On Tue, Nov 1, 2016 at 12:23 AM, Tapani Pälli <[email protected]
> <mailto:[email protected]>> wrote:
>
>     Patch uses XFree to free the memory returned by glXChooseFBConfig.
>
>     --- 8< ---
>     ==21042== 512 bytes in 1 blocks are definitely lost in loss record
>     114 of 134
>     ==21042==    at 0x4C2BBAD: malloc (vg_replace_malloc.c:299)
>     ==21042==    by 0x518E4F3: glXGetFBConfigs (glxcmds.c:1690)
>     ==21042==    by 0x518F6DE: glXChooseFBConfig (glxcmds.c:1608)
>     ==21042==    by 0x4F23A64: X11_GL_CreateContext (SDL_x11opengl.c:642)
>
>     Signed-off-by: Tapani Pälli <[email protected]
>     <mailto:[email protected]>>
>     ---
>      src/video/x11/SDL_x11opengl.c | 2 ++
>      1 file changed, 2 insertions(+)
>
>     diff --git a/src/video/x11/SDL_x11opengl.c
>     b/src/video/x11/SDL_x11opengl.c
>     index abc699d..f7264b7 100644
>     --- a/src/video/x11/SDL_x11opengl.c
>     +++ b/src/video/x11/SDL_x11opengl.c
>     @@ -649,6 +649,8 @@ X11_GL_CreateContext(_THIS, SDL_Window * window)
>
>      framebuffer_config[0],
>                                                          share_context,
>     True, attribs);
>                      }
>     +                if (framebuffer_config)
>     +                    X11_XFree(framebuffer_config);
>                  }
>              }
>              X11_XFree(vinfo);
>     --
>     2.7.4
>
>     _______________________________________________
>     SDL mailing list
>     [email protected] <mailto:[email protected]>
>     http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
>     <http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org>
>
>
>
>
> _______________________________________________
> SDL mailing list
> [email protected]
> http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.