]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
fix a memory leak of glsl shader permutations
authordivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Thu, 13 Jan 2011 06:57:04 +0000 (06:57 +0000)
committerdivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Thu, 13 Jan 2011 06:57:04 +0000 (06:57 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@10699 d7cf8633-e32d-0410-b094-e92efae38249

gl_rmain.c

index 1ec229b7564ce6948e43fb5dfab7d8048ad05fe4..7195aad59509dcc1409a82f46096dfd527ddf6a1 100644 (file)
@@ -6776,7 +6776,7 @@ skinframe_t *R_SkinFrame_LoadInternalQuake(const char *name, int textureflags, i
                Con_Printf("loading quake skin \"%s\"\n", name);
 
        // we actually don't upload anything until the first use, because mdl skins frequently go unused, and are almost never used in both modes (colormapped and non-colormapped)
-       skinframe->qpixels = (unsigned char *)Mem_Alloc(r_main_mempool, width*height);
+       skinframe->qpixels = (unsigned char *)Mem_Alloc(r_main_mempool, width*height); // FIXME LEAK
        memcpy(skinframe->qpixels, skindata, width*height);
        skinframe->qwidth = width;
        skinframe->qheight = height;
@@ -7283,6 +7283,23 @@ void gl_main_shutdown(void)
        memset(&r_bloomstate, 0, sizeof(r_bloomstate));
        memset(&r_waterstate, 0, sizeof(r_waterstate));
        R_GLSL_Restart_f();
+
+       r_glsl_permutation = NULL;
+       memset(r_glsl_permutationhash, 0, sizeof(r_glsl_permutationhash));
+       Mem_ExpandableArray_FreeArray(&r_glsl_permutationarray);
+       glslshaderstring = NULL;
+#ifdef SUPPORTCG
+       r_cg_permutation = NULL;
+       memset(r_cg_permutationhash, 0, sizeof(r_cg_permutationhash));
+       Mem_ExpandableArray_FreeArray(&r_cg_permutationarray);
+       cgshaderstring = NULL;
+#endif
+#ifdef SUPPORTD3D
+       r_hlsl_permutation = NULL;
+       memset(r_hlsl_permutationhash, 0, sizeof(r_hlsl_permutationhash));
+       Mem_ExpandableArray_FreeArray(&r_hlsl_permutationarray);
+       hlslshaderstring = NULL;
+#endif
 }
 
 extern void CL_ParseEntityLump(char *entitystring);