Author: khornicek
Date: Fri May 16 15:52:15 2014
New Revision: 63314
URL:
http://svn.reactos.org/svn/reactos?rev=63314&view=rev
Log:
[OPENGL32]
- don't try to free an invalid address
Modified:
trunk/reactos/dll/opengl/opengl32/wgl_font.c
Modified: trunk/reactos/dll/opengl/opengl32/wgl_font.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/opengl/opengl32/wgl_fo…
==============================================================================
--- trunk/reactos/dll/opengl/opengl32/wgl_font.c [iso-8859-1] (original)
+++ trunk/reactos/dll/opengl/opengl32/wgl_font.c [iso-8859-1] Fri May 16 15:52:15
2014
@@ -347,7 +347,7 @@
BYTE *buf;
TTPOLYGONHEADER *pph;
TTPOLYCURVE *ppc;
- GLdouble *vertices = NULL;
+ GLdouble *vertices = NULL, *vertices_temp = NULL;
int vertex_total = -1;
if(unicode)
@@ -359,6 +359,9 @@
goto error;
buf = HeapAlloc(GetProcessHeap(), 0, needed);
+
+ if(!buf)
+ goto error;
if(unicode)
GetGlyphOutlineW(hdc, glyph, GGO_NATIVE, &gm, needed, buf,
&identity);
@@ -393,7 +396,7 @@
while(!vertices)
{
if(vertex_total != -1)
- vertices = HeapAlloc(GetProcessHeap(), 0, vertex_total * 3 *
sizeof(GLdouble));
+ vertices_temp = vertices = HeapAlloc(GetProcessHeap(), 0, vertex_total *
3 * sizeof(GLdouble));
vertex_total = 0;
pph = (TTPOLYGONHEADER*)buf;
@@ -521,8 +524,11 @@
pgluTessEndPolygon(tess);
funcs->Translated((GLdouble)gm.gmCellIncX / em_size, (GLdouble)gm.gmCellIncY /
em_size, 0.0);
funcs->EndList();
+
HeapFree(GetProcessHeap(), 0, buf);
- HeapFree(GetProcessHeap(), 0, vertices);
+
+ if(vertices_temp)
+ HeapFree(GetProcessHeap(), 0, vertices_temp);
}
error: