summaryrefslogtreecommitdiffstats
path: root/src/glu/sgi/libnurbs/interface
diff options
context:
space:
mode:
authorDaniel Zimmermann <[email protected]>2008-11-26 11:48:53 +0100
committerBrian Paul <[email protected]>2008-11-26 07:20:02 -0700
commitc03af8e78069921d02cf4d9b70aabb82d5326764 (patch)
treeaefa5a8e08ed5323ffbc584e476f3b14e18cb490 /src/glu/sgi/libnurbs/interface
parent8d95e66cf78921cd067c4bcf6a1053a7ec3a2ed4 (diff)
fix possible memory leak in bezierPatchMeshMake
Diffstat (limited to 'src/glu/sgi/libnurbs/interface')
-rw-r--r--src/glu/sgi/libnurbs/interface/bezierPatchMesh.cc17
1 files changed, 8 insertions, 9 deletions
diff --git a/src/glu/sgi/libnurbs/interface/bezierPatchMesh.cc b/src/glu/sgi/libnurbs/interface/bezierPatchMesh.cc
index 3dc16313fff..ac7ff84fc4a 100644
--- a/src/glu/sgi/libnurbs/interface/bezierPatchMesh.cc
+++ b/src/glu/sgi/libnurbs/interface/bezierPatchMesh.cc
@@ -103,23 +103,22 @@ bezierPatchMesh *bezierPatchMeshMake(int maptype, float umin, float umax, int us
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;