[ros-diffs] [khornicek] 40286: - fix possible memory leak (patch from Mesa3D by Daniel Zimmermann)

khornicek at svn.reactos.org khornicek at svn.reactos.org
Sun Mar 29 15:39:19 CEST 2009


Author: khornicek
Date: Sun Mar 29 17:39:18 2009
New Revision: 40286

URL: http://svn.reactos.org/svn/reactos?rev=40286&view=rev
Log:
- fix possible memory leak (patch from Mesa3D by Daniel Zimmermann)

Modified:
    trunk/reactos/dll/win32/glu32/libnurbs/interface/bezierPatchMesh.cc

Modified: trunk/reactos/dll/win32/glu32/libnurbs/interface/bezierPatchMesh.cc
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/glu32/libnurbs/interface/bezierPatchMesh.cc?rev=40286&r1=40285&r2=40286&view=diff
==============================================================================
--- trunk/reactos/dll/win32/glu32/libnurbs/interface/bezierPatchMesh.cc [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/glu32/libnurbs/interface/bezierPatchMesh.cc [iso-8859-1] Sun Mar 29 17:39:18 2009
@@ -105,23 +105,22 @@
   int dimension;
   int the_ustride;
   int the_vstride;
-  
-  bezierPatchMesh *ret = (bezierPatchMesh*) malloc(sizeof(bezierPatchMesh));
-  assert(ret);
-
-  ret->bpatch = NULL;
-  ret->bpatch_normal = NULL;
-  ret->bpatch_color  = NULL;
-  ret->bpatch_texcoord = NULL;
- 
+
   if(maptype == GL_MAP2_VERTEX_3) dimension = 3;
   else if (maptype==GL_MAP2_VERTEX_4) dimension = 4;
   else {
     fprintf(stderr, "error in inMap2f, maptype=%i is wrong, maptype,map is invalid\n", maptype);
     return NULL;
   }
-  
+
+  bezierPatchMesh *ret = (bezierPatchMesh*) malloc(sizeof(bezierPatchMesh));
+  assert(ret);
+
+  ret->bpatch_normal = NULL;
+  ret->bpatch_color  = NULL;
+  ret->bpatch_texcoord = NULL;
   ret->bpatch = bezierPatchMake(umin, vmin, umax, vmax, uorder, vorder, dimension);
+
   /*copy the control points there*/
   the_ustride = vorder * dimension;
   the_vstride = dimension;



More information about the Ros-diffs mailing list