From: blub Date: Mon, 4 Jan 2010 10:56:38 +0000 (+0000) Subject: patch by a_grue: fix some memory leaks in the GLX client - the manpages confirm that... X-Git-Tag: xonotic-v0.1.0preview~872 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=0dc7a8aa708e5d408eb1c8a82fa95e5c47665493;p=xonotic%2Fdarkplaces.git patch by a_grue: fix some memory leaks in the GLX client - the manpages confirm that the data has to be freed by the caller git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@9776 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/vid_glx.c b/vid_glx.c index 0ed0c38b..01d2486b 100644 --- a/vid_glx.c +++ b/vid_glx.c @@ -1016,6 +1016,9 @@ qboolean VID_InitMode(viddef_mode_t *mode) } XmbSetWMProperties(vidx11_display, win, gamename, gamename, (char **) com_argv, com_argc, szhints, wmhints, clshints); + // strdup() allocates using malloc(), should be freed with free() + free(clshints->res_name); + free(clshints->res_class); XFree(clshints); XFree(wmhints); XFree(szhints); @@ -1042,6 +1045,7 @@ qboolean VID_InitMode(viddef_mode_t *mode) //XSync(vidx11_display, False); ctx = qglXCreateContext(vidx11_display, visinfo, NULL, True); + XFree(visinfo); // glXChooseVisual man page says to use XFree to free visinfo if (!ctx) { Con_Printf ("glXCreateContext failed\n"); @@ -1153,6 +1157,8 @@ size_t VID_ListModes(vid_mode_t *modes, size_t maxcount) ++k; } } + // manpage of XF86VidModeGetAllModeLines says it should be freed by the caller + XFree(vidmodes); return k; } return 0; // FIXME implement this